Syntax :
Select Column_Name1,Column_Name2
from Table1 as A
Inner join Table2 as B
On A.column_name = B.column_name
consider the following table : Salary:
Emp_id | Emp_salary | Emp_desig |
---|---|---|
01 | 25000 | Software Eng |
02 | 30000 | Senior Software Eng |
03 | 25000 | Software Analyst |
Query of self join:
select *
from salary as a
inner join salary as b
on a.Emp_id = b.Emp_id
Emp_id | Emp_salary | Emp_desig | Emp_id | Emp_salary | Emp_desig |
---|---|---|---|---|---|
01 | 25000 | Software Eng | 01 | 25000 | Software Eng |
02 | 30000 | Senior Software Eng | 02 | 30000 | Senior Software Eng |
03 | 25000 | Software Analyst | 03 | 25000 | Software Analyst |
Syntax :
Select Column_Name1,Column_Name2
from Table1
Full outer join Table2
On Table1.column_name = Table2.column_name
consider the following table : Salary:
Emp_id | Emp_salary | Emp_desig |
---|---|---|
01 | 25000 | Software Eng |
02 | 30000 | Senior Software Eng |
03 | 25000 | Software Analyst |
05 | 35000 | Software lead |
Employee_detail:
Emp_id | Emp_city | Emp_gender |
---|---|---|
01 | Pune | Male |
02 | Delhi | Female |
03 | Noida | Male |
04 | Gurgaon | Female |
Query of self join:
select *
from salary as a
inner join salary as b
on a.Emp_id = b.Emp_id
Emp_id | Emp_salary | Emp_desig | Emp_id | Emp_city | Emp_gender |
---|---|---|---|---|---|
01 | 25000 | Software Eng | 01 | Pune | Male |
02 | 30000 | Senior Software Eng | 02 | Delhi | Female |
03 | 25000 | Software Analyst | 03 | Noida | Male |
Null | Null | Null | 04 | Gurgaon | Female |
05 | 35000 | Software lead | Null | Null | Null |
No comments:
Post a Comment