Tables, Keys & Constraints · Question 6 · Easy

Which statement can remove only those rows of a table that satisfy a condition, such as orders older than 2020?

  1. TRUNCATE
  2. DELETE
  3. DROP
  4. ALTER
Answer and explanation

Answer: B. DELETE

Explanation: DELETE takes a WHERE clause and removes just the matching rows. TRUNCATE always empties the whole table, DROP removes the table itself and ALTER changes its structure.

Previous: How many PRIMARY KEY constraints can one table have? · Next: What happens when the INSERT with a price of -50 runs?

Practise tables, keys & constraints

Try a fresh set of tables, keys & constraints questions with an explanation after every answer, free and without signing up: Tables, Keys & Constraints practice. Or sit a full placement mock test.

More tables, keys & constraints questions

More sql practice

DML & Transactions · SELECT, WHERE & ORDER BY · SQL Joins · Aggregates & GROUP BY · Subqueries & CTEs · Window Functions · NULL Handling · SQL Functions & CASE

LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge