Learn with Abdou

Chapter 9 · Concept 4 of 6 · Practice

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

Level 1: Watch it answered · Exercise 1 of 1

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

  1. DELETE FROM menu_items: the table. There is no column list, because DELETE removes whole rows.
  2. WHERE id = 45: the one row. Without it, the statement would empty the table.
  3. Afterwards, count: 44 items, and the highest id is now 44.

From the reading: Preview, then delete, paragraph 1

The queryOpening the database…
DELETE FROM menu_items
WHERE id = 45;
Open in the playground

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.