filmov
tv
SQL Tutorial #19 Introduction to joins in SQL
Показать описание
A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
Use an inner join when: You don’t need to show all the records from the first table or all the records from the second table.
Use a left join when: You need to show all the records from the first table, but you don’t need to show all the records from the second table.
Use a right join when: You don’t need to show all the records from the first table, but you do need to show all the records from the second table.
Use a full join when: You need to show all the records from the first and second tables, and you need to join the tables based on one or more columns.
Use a cross join when: You need to show all the records from the first and second tables, but you don’t need to join the tables based on one or more columns.
Use an inner join when: You don’t need to show all the records from the first table or all the records from the second table.
Use a left join when: You need to show all the records from the first table, but you don’t need to show all the records from the second table.
Use a right join when: You don’t need to show all the records from the first table, but you do need to show all the records from the second table.
Use a full join when: You need to show all the records from the first and second tables, and you need to join the tables based on one or more columns.
Use a cross join when: You need to show all the records from the first and second tables, but you don’t need to join the tables based on one or more columns.