Challenge - 5 Problems
FULL OUTER JOIN Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Which databases support FULL OUTER JOIN natively?
Consider these popular SQL databases: MySQL, PostgreSQL, SQL Server, and SQLite. Which of them supports FULL OUTER JOIN as a native SQL feature?
Attempts:
2 left
💡 Hint
Think about which databases have FULL OUTER JOIN as a direct keyword in their SQL syntax.
✗ Incorrect
PostgreSQL and SQL Server support FULL OUTER JOIN directly. MySQL and SQLite do not have native FULL OUTER JOIN syntax.
❓ query_result
intermediate2:00remaining
What is the output of this FULL OUTER JOIN query in PostgreSQL?
Given two tables:
Table A:
id | name
1 | Alice
2 | Bob
Table B:
id | city
2 | Paris
3 | Tokyo
What is the result of:
Table A:
id | name
1 | Alice
2 | Bob
Table B:
id | city
2 | Paris
3 | Tokyo
What is the result of:
SELECT A.id, A.name, B.city FROM A FULL OUTER JOIN B ON A.id = B.id ORDER BY A.id, B.id;
SQL
CREATE TABLE A (id INT, name TEXT); INSERT INTO A VALUES (1, 'Alice'), (2, 'Bob'); CREATE TABLE B (id INT, city TEXT); INSERT INTO B VALUES (2, 'Paris'), (3, 'Tokyo'); SELECT A.id, A.name, B.city FROM A FULL OUTER JOIN B ON A.id = B.id ORDER BY A.id, B.id;
Attempts:
2 left
💡 Hint
FULL OUTER JOIN returns all rows from both tables, matching where possible.
✗ Incorrect
The FULL OUTER JOIN returns all rows from both tables. For id=1, only A has data, so city is NULL. For id=2, both tables have data. For id=3, only B has data, so name is NULL.
📝 Syntax
advanced2:00remaining
Which query correctly simulates FULL OUTER JOIN in MySQL?
MySQL does not support FULL OUTER JOIN natively. Which of these queries correctly simulates a FULL OUTER JOIN between tables A and B on column id?
Attempts:
2 left
💡 Hint
FULL OUTER JOIN can be simulated by combining LEFT JOIN and RIGHT JOIN results with UNION.
✗ Incorrect
Option D uses LEFT JOIN and UNION to combine all rows from both tables, simulating FULL OUTER JOIN. Option D uses UNION ALL but misses filtering correctly. Option D is INNER JOIN only. Option D is invalid syntax in MySQL.
❓ optimization
advanced1:30remaining
Which optimization improves FULL OUTER JOIN performance in SQL Server?
You have a large FULL OUTER JOIN query joining tables A and B on id. Which optimization can improve performance?
Attempts:
2 left
💡 Hint
Indexes help the database find matching rows faster.
✗ Incorrect
Indexes on join columns speed up matching rows in joins. Removing indexes or using CROSS JOIN will degrade performance or change results.
🔧 Debug
expert1:30remaining
Why does this FULL OUTER JOIN query fail in SQLite?
Given this query:
Why does it fail in SQLite?
SELECT A.id, B.id FROM A FULL OUTER JOIN B ON A.id = B.id;
Why does it fail in SQLite?
Attempts:
2 left
💡 Hint
Check SQLite's join capabilities.
✗ Incorrect
SQLite does not support FULL OUTER JOIN syntax at all, so the query fails with a syntax error.