SQL Quest › SQL Interview Questions › Querying Basics
Promote Your Best Customers
Loyalty is rolling out a new top tier. Every customer with 12 or more total orders becomes 'Platinum'.
Update their membership, then show customer_id, name, total_orders, membership for everyone now on Platinum, ordered by customer_id.
The new idea, and the one that costs people real data: UPDATE without a WHERE clause updates every row in the table. There is no confirmation prompt and no undo. Write the WHERE first and the SET second if it helps — a habit worth building before you are pointed at production.
Solve it in the browser editor →
Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".
Schema
customers
| customer_id | name | signup_date | membership | total_orders | |
|---|---|---|---|---|---|
| 1 | John Smith | john.smith@email.com | 2023-01-15 | Gold | 15 |
| 2 | Emma Wilson | emma.wilson@email.com | 2023-03-20 | Silver | 8 |
| 3 | Michael Brown | michael.brown@email.com | 2023-02-10 | Gold | 12 |
Expected output: 4 rows, all now Platinum
Hint
UPDATE, DML, WHERE, and open the hint there if you stall.Concepts
UPDATE DML WHERE
Practise the topic: SQL practice questions
Related questions
Where would this cost you points in an interview?
Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.
Take the readiness test