Before this, I had a bit confuse on some of the SQL statement especially the JOIN statements. Ok, Let’s see…
There are 3 types of JOIN:
It basically combines all the rows in the both tables. Meaning that if you have 20 rows in table 1 and 8 rows in table 2, therefore, the number of rows will be after cross join both of them is 20*8 = 160 rows (Cartesian Product).
Returns only rows where a match is found in both tables. So when there is comparison between 2 tables it will only search and display the matching rows.
Returns all rows from one table and any matching rows from second table. This mean that it will display all the rows in table 1 and display only the matching rows from the table 2. (this example is the left join).
In outer join there are 3 type of outer join which they are:
Note: It will return all the rows in the left table even if there are no matches in the right table.
Note: It will return all the rows in the right table even if there are no matches in the left table.
Note: It will return all the rows in the left table 1 and in the right table, If there are no matches in either of the table, those rows will be listed as well.
That’s it. Hope this helps.
– Farrah K.