SQL Syntax -- Joins

来源:互联网 发布:mac下载qq游戏大厅 编辑:程序博客网 时间:2024/04/30 06:40

SQL Joins are used to combine ROWS from two or more tables. Join operator is a must to know in the interview. It always a good interview question on SQL. 

Different SQL JOINS

INNER JOIN: Returns all rows when there is at least one match in BOTH tables

LEFT JOIN: Return all rows from the left table, and the matched rows from the right table.

RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table

FULL (OUTER) JOIN: Return all rows when there is a match in ONE of the tables.

-- SQL INNER JOIN SyntaxSELECT colNameFROM table1(INNER/LEFT/RIGHT/FULL OUTER) JOIN table2ON table1.colName = table2.colName
INNER JOIN is same as JOIN





0 0