SQL LEFT JOIN Keyword
来源:互联网 发布:多分类roc曲线 python 编辑:程序博客网 时间:2024/05/23 22:45
SQL LEFT JOIN Keyword
The LEFT JOIN keyword returns all rows from the left table (table_name1), even if there are no matches in the right table (table_name2).
SQL LEFT JOIN Syntax
SELECT column_name(s)
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
FROM table_name1
LEFT JOIN table_name2
ON table_name1.column_name=table_name2.column_name
PS: In some databases LEFT JOIN is called LEFT OUTER JOIN.
SQL LEFT JOIN Example
The "Persons" table:
The "Orders" table:
Now we want to list all the persons and their orders - if any, from the tables above.
We use the following SELECT statement:
SELECT Persons.LastName, Persons.FirstName, Orders.OrderNo
FROM Persons
LEFT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
FROM Persons
LEFT JOIN Orders
ON Persons.P_Id=Orders.P_Id
ORDER BY Persons.LastName
The result-set will look like this:
The LEFT JOIN keyword returns all the rows from the left table (Persons), even if there are no matches in the right table (Orders).
- SQL LEFT JOIN Keyword
- SQL Left Join 了解
- SQL LEFT JOIN 关键字
- SQL LEFT JOIN 关键字
- SQL LEFT JOIN 关键字
- SQL LEFT JOIN
- SQL LEFT JOIN 关键字
- SQL LEFT JOIN
- sql 语句left join
- sql left join 用法
- SQL LEFT JOIN 关键字
- SQL LEFT JOIN 关键字
- 【SQL】LEFT JOIN 关键字
- SQL LEFT JOIN
- sql的left join
- SQL LEFT JOIN 关键字
- SQL LEFT JOIN 关键字
- SQL语句LEFT JOIN
- win + linux 双系统下删除Linux,终极版!
- audiostreamer.h
- Linphone 拨打电话流程
- dev/console和/dev/tty
- MFC对话框中添加启动画面
- SQL LEFT JOIN Keyword
- MFC如何封装WINDOWS应用程序的流程
- html5 sessionStorage和localStorage迭代遍历
- jvm crash 的崩溃日志详细分析及注意点
- android.os.NetworkOnMainThreadException 异常的处理
- 新的旅程
- ASP.NET的十步学习法——第十步 .
- linux软中断机制
- 在eclipse中关联android源代码