Basic Joins in SQL
Generally, tables are related to each other using Foreign Key constraints. Joins in SQL combines records from two related tables to retrieve the data
Different types of Joins
Inner Join or Join: Returns only the matching rows from both the tables
Outer Join: Outer Joins are of 3 types
Full Outer Join or Full Join: Returns all the rows, including non-matching rows from both left and right tables.
Left Outer Join or Left Join: Returns all the rows from the left table and only matching rows from the right.
Right Outer Join or Right Join: Returns all the rows from the right table and only matching rows from the left.
Cross Join: Cross Join selects all the rows from the first table and all the rows from the second table that does not have a WHERE clause produces Cartesian product i.e. with all possibilities. In simple words, Cross Join creates all possible combination of records irrespective of a table being related or not. Cross Join shouldn’t have ON clause
General Syntax for Joins