Join
A JOIN clause is used to combine rows from two or more tables, based on
a related column between them.
INNER JOIN
Returns based on only matching rows b/w two tables
Syntax:
We can also select columns from both the tables.
LEFT JOIN
The LEFT JOIN keyword returns all records from the left table (table1), and
the matching records from the right table (table2). The result is 0 records
from the right side, if there is no match.
Syntax:
Example:
o/p:
FULL OUTER JOIN
o Returns all rows from both tables.
o If there is no match, it fills in NULL for the missing side
Tip: FULL OUTER JOIN and FULL JOIN are the same.
Syntax
Self join:
1.
2.
Q. Write a SQL query using a self join to display pairs of books that
belong to the same series, but not the same book.