Presentation is loading. Please wait.

Presentation is loading. Please wait.

Trainer: Bach Ngoc Toan– TEDU Website:

Similar presentations


Presentation on theme: "Trainer: Bach Ngoc Toan– TEDU Website:"— Presentation transcript:

1 Trainer: Bach Ngoc Toan– TEDU Website: http://tedu.com.vn
Lesson 25 SQL outer join Trainer: Bach Ngoc Toan– TEDU Website:

2 SQL OUTER JOIN In the SQL outer JOIN all the content of the both tables are integrated together either they are matched or not. Outer join of two types: 1.Left outer join (also known as left join): this join returns all the rows from left table combine with the matching rows of the right table. If you get no matching in the right table it returns NULL values. 2.Right outer join (also known as right join): this join returns all the rows from right table are combined with the matching rows of left table .If you get no column matching in the left table .it returns null value.

3 SQL LEFT JOIN Keyword The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match. SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name = table2.colu mn_name;  In some databases LEFT JOIN is called LEFT OUTER JOIN.

4 SQL RIGHT JOIN Keyword The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1). The result is NULL from the left side, when there is no match. SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column _name;  In some databases RIGHT JOIN is called RIGHT OUTER JOIN.


Download ppt "Trainer: Bach Ngoc Toan– TEDU Website:"

Similar presentations


Ads by Google