SQL Database Relational Join Logic Quiz
A 50-question quiz exploring join operations including inner joins, left joins, right joins, full joins, cross joins, and join conditions.
Question 1
A company wants to list only employees who belong to a department. Which join returns only rows with matching department records?
Question 2
A retailer wants to show all products, even those without sales yet. Which join ensures products appear regardless of sales?
Question 3
A user checks which orders lack assigned customers because of missing customer IDs. Which join helps reveal orders without a match?
Question 4
A student portal wants to show all students and all courses, even if some combinations have no enrollment. Which join captures all rows from both sides?
Question 5
A system lists employees and their managers from within the same table. What join technique compares rows of a table with itself?
Question 6
A product list is paired with every available color option to form combinations. Which join intentionally forms all possible row pairs?
Question 7
A report shows customers even if they have no orders, but only shows orders when they match a customer. Which join is at work?
Question 8
A query compares student IDs from one table to matching records in another. Why is an ON condition required?
Question 9
A developer notices NULL on the right side of a left join. What does this usually indicate?
Question 10
In a comparison of right join and left join, which behavior uniquely belongs to right joins?
Question 11
A dataset uses INNER JOIN when retrieving invoices and their customers. Why do unmatched invoices disappear from the result?
Question 12
A store wants to show both customers with orders and customers without orders, while also showing orders without customers. Which join works?
Question 13
A manufacturer uses a CROSS JOIN to list all material and size combinations. Why might the resulting table be very large?
Question 14
Why must columns used in join comparisons generally share compatible data types?
Question 15
A self join compares parent IDs to child IDs within one table. Why is table aliasing necessary?
Question 16
Why might an inner join shrink the number of returned rows compared to the original tables?
Question 17
A left join lists all customers and shows NULL for order details if none exist. Why is this helpful in reporting?
Question 18
A cross join produces a pattern where every supplier is paired with every region. What is this pattern called?
Question 19
A report shows suppliers with no products after a right join. Why?
Question 20
A chain of joins connects employees → departments → locations. Why is join order important?
Question 21
A query uses FULL JOIN to list all rows from both tables. Why might some fields show NULL?
Question 22
A developer uses JOIN without specifying an ON condition. Why might the query produce unexpected results?
Question 23
A query extracting customer orders uses a join condition on customer_id. Why must the values in customer_id be consistent?
Question 24
A financial system uses INNER JOIN to combine transactions with accounts. Why might unmatched transactions be purposely excluded?
Question 25
Why is a CROSS JOIN useful when generating all possible pairings between two sets, such as time slots and rooms?
Question 26
What does this query show about orders and customers?
SELECT o.id, c.name FROM orders o INNER JOIN customers c ON o.customer_id = c.id;Question 27
This query keeps all customers even when order info is missing. What result appears?
SELECT c.id, o.id FROM customers c LEFT JOIN orders o ON c.id = o.customer_id;Question 28
What does this right join preserve?
SELECT p.name, r.region FROM products p RIGHT JOIN regions r ON p.region_id = r.id;Question 29
This full join mixes employees and departments. What rows appear?
SELECT e.name, d.name FROM employees e FULL JOIN departments d ON e.dept_id = d.id;Question 30
A cross join creates pairings between products and categories. What does the output look like?
SELECT p.name, c.type FROM products p CROSS JOIN categories c;Question 31
What does this join reveal about book authors?
SELECT b.title, a.name FROM books b INNER JOIN authors a ON b.author_id = a.id;Question 32
Which rows survive this filtering left join?
SELECT u.username, p.post FROM users u LEFT JOIN posts p ON u.id = p.user_id WHERE p.user_id IS NOT NULL;Question 33
This join links orders and shipments. What happens when a shipment is missing?
SELECT o.id, s.date FROM orders o LEFT JOIN shipments s ON o.id = s.order_id;Question 34
What output shape results from joining students to enrollments on student IDs?
SELECT s.name, e.course_id FROM students s INNER JOIN enrollments e ON s.id = e.student_id;Question 35
A query finds missing matches with this structure. What rows appear?
SELECT a.id, b.value FROM a LEFT JOIN b ON a.id = b.a_id WHERE b.a_id IS NULL;Question 36
What does this multi-join accomplish?
SELECT e.name, d.name, l.city FROM employees e INNER JOIN departments d ON e.dept_id = d.id INNER JOIN locations l ON d.loc_id = l.id;Question 37
This join lists suppliers and their products. How are unmatched suppliers represented?
SELECT s.name, p.name FROM suppliers s LEFT JOIN products p ON s.id = p.supplier_id;Question 38
A cross join mixes all days with all shifts. What is the result size?
SELECT d.day, s.shift FROM days d CROSS JOIN shifts s;Question 39
This join finds employees whose departments lack location records. What pattern is used?
SELECT e.id FROM employees e LEFT JOIN departments d ON e.dept_id = d.id WHERE d.id IS NULL;Question 40
What does this grouped join output represent?
SELECT c.country, COUNT(*) FROM customers c INNER JOIN orders o ON c.id = o.customer_id GROUP BY c.country;Question 41
Which rows appear after this join filters NULL matches?
SELECT c.name FROM categories c LEFT JOIN items i ON c.id = i.cat_id WHERE i.cat_id IS NOT NULL;Question 42
What is the effect of this join condition?
SELECT p.name, b.title FROM publishers p INNER JOIN books b ON p.id = b.publisher_id;Question 43
This full join connects customers and feedback. What rows are included?
SELECT c.id, f.comment FROM customers c FULL JOIN feedback f ON c.id = f.customer_id;Question 44
This self join compares employees by manager. What does it show?
SELECT e.name, m.name FROM employees e JOIN employees m ON e.manager_id = m.id;Question 45
This join helps detect orphan rows. What does it return?
SELECT o.id FROM orders o LEFT JOIN customers c ON o.customer_id = c.id WHERE c.id IS NULL;Question 46
A join links countries and regions. How are unmatched countries represented?
SELECT c.name, r.name FROM countries c LEFT JOIN regions r ON c.region_id = r.id;Question 47
This join enriches products with supplier data. What does the ON condition enforce?
SELECT p.name, s.contact FROM products p INNER JOIN suppliers s ON p.supplier_id = s.id;Question 48
This join simulates a calendar expansion. What does it produce?
SELECT d.date, s.slot FROM dates d CROSS JOIN slots s;Question 49
This join keeps all products and adds brand info when available. What does it show?
SELECT p.name, b.brand FROM products p LEFT JOIN brands b ON p.brand_id = b.id;Question 50
A company links events to locations. What does this inner join produce?
SELECT e.title, l.place FROM events e INNER JOIN locations l ON e.location_id = l.id;