SQL QuestSQL Interview Questions › Querying Basics

Promote Your Best Customers

EasyFreeQuerying Basics

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_idnameemailsignup_datemembershiptotal_orders
1John Smithjohn.smith@email.com2023-01-15Gold15
2Emma Wilsonemma.wilson@email.com2023-03-20Silver8
3Michael Brownmichael.brown@email.com2023-02-10Gold12

Expected output: 4 rows, all now Platinum

Hint

The hint for this one spells out most of the query, so it stays in the editor. Reach for UPDATE, DML, WHERE, and open the hint there if you stall.

Concepts

UPDATE DML WHERE

Practise the topic: SQL practice questions

Related questions

Your First QueryEasy · FreePick Your ColumnsEasy · FreeFilter with WHEREEasy · FreeComparison OperatorsEasy · FreeMultiple Conditions (AND / OR)Easy · FreeThe IN OperatorEasy · Free

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