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
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;
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!