Preview, then delete
DELETE ... WHERE, and what remains · level 1 of 6
Opening your saved work…
Sign in to save across devices → · Download your guest work before switching accounts.
Preview, then delete · DELETE ... WHERE, and what remains · level 1 of 6
Take the large hot chocolate off the menu
Menu item 45, the Large Hot Chocolate, is discontinued. Watch the delete, run it, and count what is left.
Data: Northshore Coffee. Every run starts from a fresh copy, so nothing you try here is permanent.
Why it works, clause by clause
- DELETE FROM menu_items: the table. There is no column list, because DELETE removes whole rows.
- WHERE id = 45: the one row. Without it, the statement would empty the table.
- Afterwards, count: 44 items, and the highest id is now 44.
From the reading: Preview, then delete, paragraph 1
DELETE FROM menu_items
WHERE id = 45;Query results
Run it to see the result here.Run it to see the result here.
Practice here is evidence for you and your instructor, never a grade. Grades live in Canvas.