Home  >  Article  >  Backend Development  >  Learn about the SQL INNER JOIN keyword

Learn about the SQL INNER JOIN keyword

jacklove
jackloveOriginal
2018-05-08 10:25:471743browse


SQL INNER JOIN keyword is very important in php, so this article will introduce its related knowledge in detail.

The INNER JOIN keyword returns rows when there is at least one match in the table.

INNER JOIN keyword syntax

SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2 
ON table_name1.column_name=table_name2.column_name

Note: INNER JOIN is the same as JOIN

Inner connection(INNER JOIN )Example

Now, we want to list everyone's orders.

You can use the following SELECT statement:

SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
INNER JOIN Orders
ON Persons.Id_P=Orders.Id_P
ORDER BY Persons.LastName

This article provides a relevant introduction to the join keyword. For more learning materials, please pay attention to the php Chinese website.

Related recommendations:

Related knowledge about SQL JOIN

Explanation of SQL Alias ​​(alias) in php

How to use the SQL BETWEEN operator

The above is the detailed content of Learn about the SQL INNER JOIN keyword. 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