WeCodeAcademy

UPDATE and DELETE

UPDATE changes existing rows and DELETE removes them. Always use WHERE, or the change hits every row.

Examplesql
Open in editor »
Examplesql
Open in editor »

Try removing the WHERE from the delete and Run it. Every order disappears. That is why careful developers write the WHERE first, or test it as a SELECT.

Quick check

What happens if you run `DELETE FROM orders;` with no WHERE?

Your turn: write the code

Change the price of the product named 'Pen' to 2, then select its price.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.