SQL-Joins-Page14
👉Joins
Sometimes it is necessary to work with multiple tables.
Using Join, a single SQL sentence can manipulate data from multiple tables.
👉Types of Joins
1)Inner Join
2)Outer(Left, Right, Full)
3)Cross
👉Inner Join
The inner join returns all rows from both tables where there is a match.
👉Left Outer Join
All rows from the first table will be displayed even though there is no matching rows in the second table.
Below query is useful if we want to list all employees even if address do not exist for that employee.
Below query is using right join and indicates that all the rows from the second table will be displayed even though there exist no matching rows in the first table.
👉Cross Join
This means that join combines every row from the left table with every row in the right table.
It may run for a very long time and produce a huge result set that may not be useful.
👉Self Join
It joins a table to itself using "inner join". In a self-join, two rows from the same table combine to form a result row.
Comments
Post a Comment