JOIN:
- join clause is used to combine the two or more table based on related column.
- INNER JOIN:
- The INNER JOIN keyword selects records that have matching values in both tables.
select * from product INNER JOIN customer on product_id = cus_id;
output:
- LEFT JOIN:
- The LEFT JOIN keyword selects ALL records from the "left" table, and the matching records from the "right" table. The result is 0 records from the right side if there is no match.
select * from product LEFT JOIN customer on product_id = cus_id;
output:
- RIGHT JOIN:
- The RIGHT JOIN keyword selects ALL records from the "right" table, and the matching records from the "left" table. The result is 0 records from the left side if there is no match.
select product_id,product_name from product RIGHT JOIN customer on product_id = cus_id;
output:
- OUTER JOIN:
- The FULL JOIN keyword selects ALL records from both tables, even if there is not a match. For rows with a match the values from both tables are available, if there is not a match the empty fields will get the value NULL.
select * from product FULL OUTER JOIN customer on product.price = customer.price;
output:
To Be Discussed:
Having
CROSS JOIN





Top comments (0)