SQL Full Joins
Advertisements
SQL Full Joins
Full Join keyword returns all rows from the left table (table1) and from the right table (table2). It is the combination of Left join and Right Join.
Syntax
SELECT column_name FROM table1 FULL OUTER JOIN table2 ON table1.column_name=table2.column_name;
Employee table
Emp_id | Name |
---|---|
101 | Amit Sukla |
102 | Rahul jain |
103 | Sultan Alam |
Payment table
Payment_id | Salary |
---|---|
101 | 20000 |
102 | 45000 |
Example
SELECT Employee.Emp_id,Employee.name, Payment.salary FROM Employee FULL OUTER JOIN Orders ON Employee.Emp_id=Payment.Payment_id
After execute above query, result show like below;
Emp_id | Name | Salary |
---|---|---|
101 | Amit Sukla | 20000 |
102 | Rahul jain | 45000 |
103 | Sultan Alam | Null |
101 | Amit Sukla | 20000 |
102 | Rahul jain | 45000 |
Google Advertisment