Home > Database > Mysql Tutorial > 数据库摘要之 Sql_Inner_Join

数据库摘要之 Sql_Inner_Join

PHPz
Release: 2018-09-30 13:36:48
Original
1405 people have browsed it

INNER JOIN 操作符 INNER JOIN 关键字在表中存在至少一个匹配时返回行。 SQL INNER JOIN 语法 SELECT column_name(s)FROM table1INNER JOIN table2ON table1.column_name=table2.column_name

INNER JOIN 操作符

INNER JOIN 关键字在表中存在至少一个匹配时返回行。

SQL INNER JOIN 语法

SELECT column_name(s)
FROM table1
INNER JOIN table2
ON table1.column_name=table2.column_name;
Copy after login

或:

SELECT column_name(s)
FROM table1
JOIN table2
ON table1.column_name=table2.column_name;
Copy after login

注释:INNER JOIN 与 JOIN 是相同的 (交集)。

Demo

SELECT Customers.CustomerName, Orders.OrderID
FROM Customers
INNER JOIN Orders
ON Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
Copy after login

Mysql

也可以用上面的写法,等同下面

SELECT Customers.CustomerName, Orders.OrderID
FROM Customers , Orders
WHERE  Customers.CustomerID=Orders.CustomerID
ORDER BY Customers.CustomerName;
Copy after login

更多相关教程请访问 MySQL视频教程

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