CodeBlanks Logo Icon CodeBlanks

Summary - DELETE

Combine WHERE and safety steps to delete safely.

Summary - DELETE

In this group you learned DELETE basics, conditional delete, delete all and TRUNCATE. Removing data is now easy.

DELETE FROM products
WHERE stock = 0;

This query removes all out-of-stock products.

Rows are deleted from products. Only the rows where stock = 0 holds are affected.

Practice Summary - DELETE

Delete the row with id=2 from products.

Starter code

query.sql
-- summary delete
DELETE FROM products
WHERE

Sample solution

query.sql
DELETE FROM products
WHERE id = 2

Expected output

1 satır silindi

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 Which empties a table quickly?

  • DELETE
  • SELECT
  • TRUNCATE Correct answer
  • DROP

Explanation: TRUNCATE empties a table quickly.

2 Summary - DELETE: match the terms

Term Meaning
DELETE delete
FROM table
WHERE condition
TRUNCATE fast delete

All lessons in Beginner