Credit portal




SQL: Joins

what is sql statement

This SQL tutorial explains how to use SQL joins with syntax, visual illustrations, and examples.


SQL JOINS are used to retrieve data from multiple tables. A SQL JOIN is performed whenever two or more tables are joined in a SQL statement.

There are 4 different types of SQL joins:

  • SQL INNER JOIN (or sometimes called simple join)
  • SQL LEFT OUTER JOIN (or sometimes called LEFT JOIN)
  • SQL RIGHT OUTER JOIN (or sometimes called RIGHT JOIN)
  • SQL FULL OUTER JOIN (or sometimes called FULL JOIN)

So let's discuss SQL JOIN syntax, look at visual illustrations of SQL JOINS, and explore SQL JOIN examples.

SQL INNER JOIN (simple join)

Chances are, you've already

written a SQL statement that uses an SQL INNER JOIN. It is the most common type of SQL join. SQL INNER JOINS return all rows from multiple tables where the join condition is met.

Visual Illustration

In this visual diagram, the SQL INNER JOIN returns the shaded area:

The SQL INNER JOIN would return the records where table1 and table2 intersect.


Here is an example of a SQL INNER JOIN:

This SQL INNER JOIN example would return all rows from the suppliers and orders tables where there is a matching supplier_id value in both the suppliers and orders tables.

We have a table called suppliers with two fields (supplier_id and supplier_name). It contains the following data:

Category: Forex

Similar articles: