DEV Community

Elizabeth Njoroge
Elizabeth Njoroge

Posted on

SQL JOINS

SQL joins allows you to combine rows from two or more tables based on a related column between them. There are different types of joints as they have different functions.

  1. Inner Join. Returns records that have matching values in both tables. This is the most common type of join, and is useful when you need to retrieve data that exists in both tables. For example " customer_id is in both tables".

  1. Left (Outer) Join. Returns all records from the left table, and the matched records from the right table. When using this join if there is no match, the columns from the right table will contain NULL. For example :

  1. Right (Outer) Join. Returns all records from the right table, and the matched records from the left table. When using this join if there is no match, the columns from the left table will contain NULL. For example:

  1. Full (Outer) Join. Returns all records when there is a match in either the left or right table. When using this join, if there is no match, the columns from the non-matching side will contain NULL. For example:

HAVE FUN WITH JOINS!!!

Top comments (0)