SQL Joins
来源:互联网 发布:淘宝网客服兼职 编辑:程序博客网 时间:2024/04/30 07:22
1. Two basic joins: Equijoins & Nonequijoins
Nonequijoins:
SELECT table1.column, table2.column
FROM table1
[JOIN table2 ON (table1.expr1< table2.expr2)]|
[JOIN table2 ON (table1.expr1 > table2.expr2)]|
[JOIN table2 ON (table1.expr1 <= table2.expr2)]|
[JOIN table2 ON (table1.expr1 >= table2.expr2)]|
[JOIN table2 ON (table1.expr1 BETWEEN table2.expr2 ANDtable2.expr3)]|
[JOIN table2 ON (table1.expr1 LIKE table2. expr2)]
2. Natural Joins
The natural join is implemented using three possible join clauses that use the following keywords in different combinations:NATURAL JOIN, USING, and ON.
3. Cross Joins
If the source and target tables have three and four rows, respectively, a cross join between them results in (3 × 4 = 12) rows being returned.
4. The Syntax
SELECT table1.column, table2.column
FROM table1
[NATURAL JOIN table2] |
[JOIN table2 USING (column_name)] |
[JOIN table2 ON (table1.column_name = table2.column_name)] |
[LEFT | RIGHT | FULL OUTER JOIN table2
ON (table1.column_name = table2.column_name)] |
[CROSS JOIN table2];
5. Inner Versus Outer Joins
6. Left Outer Joins
SELECT table1.column, table2.column
FROM table1
LEFT OUTER JOIN table2
ON (table1.column = table2.column);
7. Right Outer Joins
SELECT table1.column, table2.column
FROM table1
RIGHT OUTER JOIN table2
ON (table1.column = table2.column);
8. Full Outer Joins
SELECT table1.column, table2.column
FROM table1
FULL OUTER JOIN table2
ON (table1.column = table2.column);
- SQL Joins
- SQL Joins
- SQL joins
- SQL JOINS
- SQL : joins
- Inside SQL Server Joins
- SQL Syntax -- Joins
- SQL - Using Inner Joins
- SQL - Using Outer Joins
- SQL - Using Cross Joins
- SQL JOINS 学习笔记
- Visual Representation of SQL Joins
- Visual Representation of SQL Joins
- Joins
- 关于sql joins的图形解说
- SQL JOINS的基本用法小解
- Natural Joins - Still not in MS SQL Server
- [大师视频翻译] SQL Joins [更新中文视频]
- 详解 QT 中Graphics View柜架(下篇)
- dllimport与dllexport作用与区别
- 股份第三个何润东
- Nginx之超时管理(定时器事件)
- 【HDU】1534 Schedule Problem 差分约束
- SQL Joins
- JSP基础
- HowTo: Use grep Command In Linux / UNIX – Examples
- tar.gz和tgz的区别
- floyed 理解
- spring mvc
- Oracle 不同故障的恢复方案
- LeetCode 2 Evaluate Reverse Polish Notation
- stncpy 函数