JOIN:-
The ‘JOIN’ keyword is used in an SQL statement to query date from two or more tables, based on relationship between certain columns in these tables.
Types of JOIN:-
I. Join (Inner-Join):- Return all rows when there is at least one match
in both tables.
Example:-
Join (Inner Join):-
SELECT Fname , Lname , order_no
From cusromers inner join orders
On customers.c_id = order.c_id ;
II. Left Join (Left Outer Join):- Return all rows from the left table, even if there are
no matches in the right table.
Example:-
no matches in the right table.
Example:-
Left Join (Left Outer Join):-
SELECT Fname , Lname , order_no
From cusromers Left join orders
On customers.c_id = order.c_id ;
III. Right Join (Right Outer Join):- Return all rows from Right table even if there
are no matches in the left table.
are no matches in the left table.
Example:-
Right Join (Right Outer Join):-
Right Join (Right Outer Join):-
SELECT Fname , Lname , order_no
From cusromers Right join orders
On customers.c_id = order.c_id ;
IV. Full Join(Full Outer Join):- Returns roes when there is a match in one of the
table.
table.
No comments:
Post a Comment