Home > Database > SQL > body text

Usage of inner join in sql

angryTom
Release: 2020-02-14 16:22:45
Original
11922 people have browsed it

Usage of inner join in sql

Usage of inner join in sql

Inner join is a multi-table connection keyword.

Syntax:

SELECT * FROM table1 INNER JOIN table2 ON table1.field1 compopr table2.field2
Copy after login

INNER JOIN operation can be divided into the following parts:

Part
Description
table1, table2
Record the name of the combined table.
field1, field2

The name of the field to be joined. If they are not composed of numbers, the fields must be of the same

data type and contain the same type of data, but they do not need to have the same name.

compopr
Any relational comparison operator: "=," "<," "> ," "<=," ">=," or "<>."

For example: you want to check Categories in 2 tables. CategoryID = Products.CategoryID field

SELECT CategoryName, ProductName
FROM Categories 
INNER JOIN Products
ON Categories.CategoryID = Products.CategoryID;
Copy after login

The meaning of 2 tables associated query related data

(free learning video tutorial recommendation: mysql video tutorial)

The above is the detailed content of Usage of inner join in sql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!