EXPERMIMENT6
NAME=AKANKSHA
B.TECH CSIT A
BATCH=A2
ROLL NO=2100290119001
SQL JOIN
A JOIN clause is used to combine rows from two or more tables, based on a related column between
them.
1=INNER JOIN Returns records that have matching values in
both tables
we can create the SQL statement (that contains an INNER JOIN), that selects records that have matching values in
both tables:
SELECT Orders.Order_id, Customers.first_name, Orders.amount
FROM Orders
INNER JOIN Customers
ON Orders.Customer_id=Customers.Customer_id;
2=LEFT (OUTER) JOIN:
Returns all records from the left table, and the matched records from
the right table
SYNTAX
SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name = table2.column_name;
3= RIGHT JOIN
syntax
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name = table2.column_name;
4= FULL OUTER JOIN
Returns all records when there is a match in either left or right table
syntax
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name = table2.column_name
WHERE condition;