# DELETE vs TRUNCATE vs DROP in SQL

Source: https://sqlstreak.com/sql/delete-vs-truncate-vs-drop · Tested on PostgreSQL 18.6 and SQLite 3.54.1; results generated 2026-11-22.


**Short answer:** `DELETE` removes rows: all of them, or only those matching `WHERE`. `TRUNCATE` empties a whole table quickly (PostgreSQL; SQLite has no TRUNCATE, and `DELETE` without `WHERE` does the job). `DROP TABLE` removes the table itself, columns and all.

## Side by side

| | DELETE | TRUNCATE | DROP TABLE |
| --- | --- | --- | --- |
| Removes | Rows (all or filtered) | Every row | The table and its rows |
| WHERE | Yes | No | No |
| Table afterwards | Still there | Still there, empty | Gone |
| SQLite | Yes | No (use DELETE without WHERE) | Yes |

## Examples

### DELETE with WHERE: some rows

Every run here is rolled back, so the sample data is safe.

```sql
DELETE FROM order_items WHERE order_id = 1;
SELECT COUNT(*) AS lines_left FROM order_items;
```

Result (both engines):

| lines_left |
| --- |
| 30 |

### TRUNCATE: every row (PostgreSQL)

```sql
TRUNCATE order_items;
SELECT COUNT(*) AS lines_left FROM order_items;
```

PostgreSQL:

| lines_left |
| --- |
| 0 |

SQLite: error: near "TRUNCATE": syntax error

### DELETE without WHERE: every row, in both

```sql
DELETE FROM order_items;
SELECT COUNT(*) AS lines_left FROM order_items;
```

Result (both engines):

| lines_left |
| --- |
| 0 |

### DROP TABLE: the table is gone

```sql
DROP TABLE order_items;
SELECT COUNT(*) FROM order_items;
```

PostgreSQL: error: relation "order_items" does not exist

SQLite: error: no such table: order_items

## When to use which

- **DELETE:** Removing specific rows, or all rows when you also need triggers to fire or want it to work in SQLite.
- **TRUNCATE:** Emptying a big PostgreSQL table quickly, for example a staging table before a reload.
- **DROP TABLE:** When the table itself should no longer exist.

## Common mistakes

- `DELETE FROM t` without WHERE when you meant a few rows. Write the WHERE first, and try it as a SELECT.
- `TRUNCATE` in SQLite: it's a syntax error there.
- Truncating or dropping a table other tables point to: PostgreSQL refuses while foreign keys reference it (unless you add CASCADE, which empties those too).
