The RIGHT JOIN returns all record from the right table (table_2), with the matching record in the left table (table_1). The result is NULL in the left side when there is no match.
Syntax:
OR
As you see,In this tutorial we have two tables like this table(1) "Employee" and table(2) "Departments".
Table 1(Employee):
Table 2(Departments):
Example:
Output:
Syntax:
SELECT *
FROM table_1
RIGHT OUTER JOIN table_2
ON table_1.column_some_name=table_2.column_some_name
FROM table_1
RIGHT OUTER JOIN table_2
ON table_1.column_some_name=table_2.column_some_name
OR
SELECT *
FROM table_1
RIGHT JOIN table_2
ON table_1.column_some_name=table_2.column_some_name
FROM table_1
RIGHT JOIN table_2
ON table_1.column_some_name=table_2.column_some_name
As you see,In this tutorial we have two tables like this table(1) "Employee" and table(2) "Departments".
Table 1(Employee):
Table 2(Departments):
Example:
SELECT * FROM Employee e1 RIGHT OUTER JOIN Departments e2
ON e1.DepartID = e2.id
ON e1.DepartID = e2.id
Output:
Post a Comment