SQL practice: How a Database Thinks
Introduction 3 · 6 questions · free to solve
Question 1 · easy
Solve it in your browserWhich column in orders is its primary key? Which columns are foreign keys?
Question 2 · easy
Solve it in your browserorder_items has a column called unit_price, and so does products. Why store the price twice instead of always looking it up in products?
Question 3 · medium
Solve it in your browserIf customer_id 3 is deleted from customers, what should happen to their orders? What does the foreign key do about it?
Question 4 · medium
Solve it in your browserExplain in one sentence why "every query returns a table" makes subqueries possible.
Question 5 · hard
Solve it in your browserRead this aloud in plain English: SELECT city FROM customers WHERE customer_type = 'Dealer';
Question 6 · hard
Solve it in your browseremployees.manager_id points at employees.employee_id — the same table. What real-world fact is that recording?
These questions are free.
Make a free account to solve them, with instant checking and an AI tutor for hints.
Start free