Home  >  Article  >  Database  >  Usage of inner join in sql

Usage of inner join in sql

angryTom
angryTomOriginal
2020-02-14 16:22:4512027browse

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

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: "=," "93807de3cf04d2db8a3dc7304dd394ff ," "5bbe8a84ecc349761d715c0b0d4ffe1e=," or "a8093152e673feb7aba1828c43532094."

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!

Statement:
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