Lets have a look at different SQL Joins !
- INNER JOIN: Returns all rows when there is at least one match in BOTH tables
- LEFT JOIN: Return all rows from the left table, and the matched rows from the right table
- RIGHT JOIN: Return all rows from the right table, and the matched rows from the left table
- FULL JOIN: Return all rows when there is a match in ONE of the tables
Inner Join :
SELECT column_name(s)FROM table1
JOIN table2
ON table1.column_name=table2.column_name;
LEFT JOIN:
SELECT column_name(s)
FROM table1
LEFT OUTER JOIN table2
ON table1.column_name=table2.column_name;
RIGHT JOIN:
SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;
FULL JOIN:
SELECT column_name(s)
FROM table1
FULL OUTER JOIN table2
ON table1.column_name=table2.column_name;
FROM table1
FULL OUTER JOIN table2
ON table1.column_name=table2.column_name;

No comments:
Post a Comment
Thanks for your messege