Professional Documents
Culture Documents
Experiment - 9: Varun 2K19/SE/142
Experiment - 9: Varun 2K19/SE/142
Experiment - 9: Varun 2K19/SE/142
Experiment – 9
Varun
2K19/SE/142
Aim : To study join commands and execute their queries
Queries: A Join is a clause used to combine two or more rows from two or
more tables, based on a related column between them.
Inner Join : The INNER JOIN keyword selects all the rows from both the tables
as long as the condition satisfies. This keyword will create the result-set by
combining all rows from both the tables where the condition values satisfies
i.e. value of the common field will be the same.
Syntax : select <table1_col1> , <table2_col2>
from <table1>
inner join <table2>
on <table1.common_column> = <table2.common_column>
Left Join: This join returns all the rows of the table on the left side of the join
and matching rows for the table on the right side of the join. The rows for
which there is no matching row on the right side, the result-set will contain
null.
Syntax: select <table1_col1> , <table2_col2>
from <table1>
left join <table2>
on <table1.common_column> = <table2.common_column>
Right Join: This join returns all the rows of the table on the right side of the
join and matching rows for the table on the left side of the join. The rows for
which there is no matching row on the left side, the result-set will contain
null.
Syntax: select <table1_col1> , <table2_col2>
from <table1>
right join <table2>
on <table1.common_column> = <table2.common_column>
QUERIES
• SELECT * FROM EMPLOYEE;
• SELECT * FROM ISSUE_STATUS;
• SELECT * FROM MEMBER INNER JOIN ISSUE_STATUS ON
MEMBER.MEMBER_ID = ISSUE_STATUS.ISSUE_MEMBER;
• SELECT * FROM MEMBER RIGHT JOIN ISSUE_STATUS ON
MEMBER.MEMBER_ID = ISSUE_STATUS.ISSUE_MEMBER;
Conclusion :
Learnt the use of join commands .