Sobes.tech
Intern — Senior

Different options for joining tables in SQL

livecode

Task condition

It is necessary to demonstrate the union of two tables using all main types of JOIN: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL OUTER JOIN, and CROSS JOIN. For each query, specify which rows will be in the result.

Given two tables TableA and TableB:

TableA   | TableB
---------|---------
id       | id
---------|---------
1        | 2
2        | 4
3        | 6
4        | 8
SELECT TableA.id, TableB.id
FROM ...