It returns all rows from both tables, matching rows where possible. If there is no match, it fills with NULLs for missing columns.
Click to reveal answer
beginner
In a FULL OUTER JOIN, what happens when a row in the left table has no matching row in the right table?
The row from the left table appears in the result with NULLs in the columns from the right table.
Click to reveal answer
intermediate
Write a simple FULL OUTER JOIN query to combine tables employees and departments on department_id.
SELECT * FROM employees FULL OUTER JOIN departments ON employees.department_id = departments.department_id;
Click to reveal answer
intermediate
How is FULL OUTER JOIN different from LEFT JOIN and RIGHT JOIN?
LEFT JOIN returns all rows from the left table and matched rows from the right. RIGHT JOIN returns all rows from the right table and matched rows from the left. FULL OUTER JOIN returns all rows from both tables, matched or not.
Click to reveal answer
beginner
Why might FULL OUTER JOIN be useful in real life?
It helps find all records from two lists, including those that don't match, like finding all customers and all orders even if some customers have no orders or some orders have no customers.
Click to reveal answer
What does FULL OUTER JOIN return?
AAll rows from both tables, matched where possible, NULLs where no match
BOnly rows that match in both tables
CAll rows from the left table only
DAll rows from the right table only
✗ Incorrect
FULL OUTER JOIN returns all rows from both tables, matching rows where possible, and NULLs for missing matches.
If a row in the right table has no match in the left table, what does FULL OUTER JOIN do?
AExcludes the row
BIncludes the row with NULLs for right table columns
COnly includes if left table has a match
DIncludes the row with NULLs for left table columns
✗ Incorrect
FULL OUTER JOIN includes unmatched rows from both tables, filling NULLs for missing side columns.
Which SQL keyword is used to perform a FULL OUTER JOIN?
AFULL OUTER JOIN
BINNER JOIN
CLEFT JOIN
DRIGHT JOIN
✗ Incorrect
The keyword FULL OUTER JOIN explicitly performs a full outer join.
What will be the result of a FULL OUTER JOIN if both tables have no matching rows?
AEmpty result
BAll rows from both tables with NULLs in unmatched columns
COnly rows from the left table
DOnly rows from the right table
✗ Incorrect
FULL OUTER JOIN returns all rows from both tables, even if no matches exist, filling NULLs accordingly.
Which join type would you use to find all records from two tables including unmatched rows?
ALEFT JOIN
BINNER JOIN
CFULL OUTER JOIN
DCROSS JOIN
✗ Incorrect
FULL OUTER JOIN returns all records from both tables including unmatched rows.
Explain in your own words what a FULL OUTER JOIN does and when you might use it.
Think about combining two lists fully, even if some items don't match.
You got /4 concepts.
Write a simple SQL query using FULL OUTER JOIN to combine two tables on a common column.
Use SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.col = table2.col;
You got /3 concepts.
Practice
(1/5)
1. What does a FULL OUTER JOIN do in PostgreSQL?
easy
A. It returns all rows from the right table and matching rows from the left table.
B. It returns only rows that have matching values in both tables.
C. It returns all rows from the left table and matching rows from the right table.
D. It returns all rows from both tables, matching where possible, and NULLs where no match exists.
Solution
Step 1: Understand the join types
INNER JOIN returns only matching rows; LEFT JOIN returns all left table rows plus matches; RIGHT JOIN returns all right table rows plus matches.
Step 2: Define FULL OUTER JOIN behavior
FULL OUTER JOIN returns all rows from both tables, matching where possible, and fills unmatched columns with NULL.
Final Answer:
It returns all rows from both tables, matching where possible, and NULLs where no match exists. -> Option D
Quick Check:
FULL OUTER JOIN = all rows both tables [OK]
Hint: Remember: FULL OUTER JOIN = all rows from both tables [OK]
Common Mistakes:
Confusing FULL OUTER JOIN with INNER JOIN
Thinking FULL OUTER JOIN returns only left or right table rows
Assuming unmatched rows are excluded
2. Which of the following is the correct syntax for a FULL OUTER JOIN in PostgreSQL?
easy
A. SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.id = table2.id;
B. SELECT * FROM table1 JOIN FULL OUTER table2 ON table1.id = table2.id;
C. SELECT * FROM table1 FULL JOIN table2 WHERE table1.id = table2.id;
D. SELECT * FROM table1 OUTER FULL JOIN table2 ON table1.id = table2.id;
Solution
Step 1: Recall PostgreSQL FULL OUTER JOIN syntax
The correct syntax is: SELECT ... FROM table1 FULL OUTER JOIN table2 ON condition;
Step 2: Check each option
The syntax 'SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.id = table2.id;' matches exactly. Others err: 'JOIN FULL OUTER' wrong order; 'FULL JOIN ... WHERE' misuses WHERE for join; 'OUTER FULL JOIN' wrong sequence.
Final Answer:
SELECT * FROM table1 FULL OUTER JOIN table2 ON table1.id = table2.id; -> Option A
D. [{1, 'Alice', NULL}, {2, 'Bob', 'Paris'}, {4, 'Diana', 'Berlin'}]
Solution
Step 1: Identify matching and unmatched IDs
Matching IDs: 2 and 4. Unmatched in A: 1. Unmatched in B: 3.
Step 2: Construct FULL OUTER JOIN result
Rows: - ID 1: Name 'Alice', City NULL (no match in B) - ID 2: Name 'Bob', City 'Paris' (match) - ID 3: Name NULL, City 'London' (no match in A) - ID 4: Name 'Diana', City 'Berlin' (match)
FULL OUTER JOIN includes all rows with NULLs for unmatched [OK]
Hint: Match IDs, include all rows, NULL for missing side [OK]
Common Mistakes:
Excluding unmatched rows from either table
Mixing up NULL placement
Ordering rows incorrectly
4. Consider this query: SELECT * FROM A FULL OUTER JOIN B ON A.id = B.id WHERE A.name = 'Alice'; Why might this query return fewer rows than expected?
medium
A. Because the WHERE clause filters out rows where A.name is NULL, excluding unmatched rows from B.
B. Because FULL OUTER JOIN only returns matching rows.
C. Because the ON condition is incorrect syntax.
D. Because the query needs GROUP BY to include all rows.
Solution
Step 1: Understand FULL OUTER JOIN with WHERE clause
FULL OUTER JOIN returns all rows, but WHERE filters after join. Filtering on A.name excludes rows where A.name is NULL (unmatched in A).
Step 2: Effect of filtering on unmatched rows
Rows unmatched in A have NULL for A.name, so WHERE A.name = 'Alice' removes them, reducing rows.
Final Answer:
Because the WHERE clause filters out rows where A.name is NULL, excluding unmatched rows from B. -> Option A
Quick Check:
WHERE filters after join, can exclude NULLs [OK]
Hint: Use WHERE carefully; it filters after join, may exclude NULLs [OK]
Common Mistakes:
Thinking FULL OUTER JOIN ignores WHERE filters
Assuming ON clause filters rows after join
Believing GROUP BY affects join row count
5. You have two tables: Employees(emp_id, name) and Departments(dept_id, emp_id, dept_name). You want a list of all employees and their departments if any, plus all departments and their employees if any. Which query correctly uses FULL OUTER JOIN to achieve this?
hard
A. SELECT e.emp_id, e.name, d.dept_name FROM Employees e RIGHT JOIN Departments d ON e.emp_id = d.emp_id;
B. SELECT e.emp_id, e.name, d.dept_name FROM Employees e FULL OUTER JOIN Departments d ON e.emp_id = d.emp_id;
C. SELECT e.emp_id, e.name, d.dept_name FROM Employees e INNER JOIN Departments d ON e.emp_id = d.emp_id;
D. SELECT e.emp_id, e.name, d.dept_name FROM Employees e LEFT JOIN Departments d ON e.emp_id = d.emp_id;
Solution
Step 1: Understand the requirement
We want all employees and their departments if any, plus all departments and their employees if any. This means all rows from both tables.
Step 2: Choose the correct join type
FULL OUTER JOIN returns all rows from both tables, matching where possible. LEFT or RIGHT JOIN only return all rows from one table.
Final Answer:
SELECT e.emp_id, e.name, d.dept_name FROM Employees e FULL OUTER JOIN Departments d ON e.emp_id = d.emp_id; -> Option B
Quick Check:
FULL OUTER JOIN returns all rows both tables [OK]
Hint: Use FULL OUTER JOIN to include all rows from both tables [OK]
Common Mistakes:
Using LEFT or RIGHT JOIN excludes unmatched rows from one table
Using INNER JOIN excludes unmatched rows
Forgetting ON condition
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.