Exp 6
Exp 6
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.
we can create the SQL statement (that contains an INNER JOIN), that selects records that have matching values in
both tables:
FROM Orders
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;