All Products
Search
Document Center

PolarDB:Deleting Data

Last Updated:Mar 28, 2026

The DELETE statement removes rows from a table. You specify which rows to remove using a WHERE condition. DELETE always operates on whole rows — there is no way to directly address individual rows.

How it works

To remove rows, you specify conditions that the rows must match. If the table has a primary key, you can target an exact row. Without a primary key, you can delete groups of rows that match a condition, or all rows at once.

The DELETE syntax is similar to UPDATE:

DELETE FROM products WHERE price = 10;

This removes every row in products where price equals 10. Omit the WHERE clause, and all rows in the table are deleted:

DELETE FROM products;
Warning

Running DELETE without a WHERE clause removes all rows immediately. Test your WHERE condition with a SELECT statement first before running DELETE against production data.

Best practices

Use a primary key to target single rows

When deleting a specific record, filter by its primary key to guarantee you affect only that row.

Test before you delete

Run a SELECT with the same WHERE condition to confirm which rows will be affected before running DELETE.

See also

  • Updating Data — The UPDATE statement uses the same WHERE clause syntax as DELETE.

  • DELETE reference — Full syntax reference for the DELETE statement.