0
0
PostgreSQLquery~5 mins

FULL OUTER JOIN in PostgreSQL - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does a FULL OUTER JOIN do in SQL?
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
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
Which SQL keyword is used to perform a FULL OUTER JOIN?
AFULL OUTER JOIN
BINNER JOIN
CLEFT JOIN
DRIGHT 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
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
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.