CodeBlanks Logo Icon CodeBlanks

Summary - FULL and CROSS JOIN

Write a missing supplier and customer report with FULL JOIN.

Summary - FULL and CROSS JOIN

FULL OUTER JOIN keeps all rows from both tables; CROSS JOIN produces all pairs.

SELECT c.name, o.id
FROM customers c
FULL OUTER JOIN orders o ON o.customer_id = c.id;

Summary full join.

c.name, o.id is selected from customers c. orders o is joined on o.customer_id = c.id, keeping every row of both tables.

Practice Summary - FULL and CROSS JOIN

Summary: FULL OUTER JOIN customers with orders.

Starter code

query.sql
-- summary full join
SELECT c.name, o.id
FROM customers c

Sample solution

query.sql
SELECT c.name, o.id
FROM customers c
FULL OUTER JOIN orders o ON o.customer_id = c.id;

Expected output

name    id
Ayşe    1
NULL    5

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Does CROSS JOIN have ON?

  • No, it does not Correct answer
  • It is required
  • It is optional
  • In some cases

Explanation: CROSS JOIN has no ON clause.

2 Summary - FULL and CROSS JOIN: match the terms

Term Meaning
FULL OUTER both
CROSS cartesian
ON condition
NULL empty

All lessons in Intermediate