On this page
  1. DELETE
  2. Syntax & Overview
  3. Notes & Best Practices
  4. Example

DELETE

Prev: `UPDATE` | Up: clauses | Next: `RETURNING`
Rel: clauses, SQL Query Execution Lifecycle
Ref: PostgreSQL — SQL Commands
Tags: #public #databases #sql #clauses #tier/core


Syntax & Overview

DELETE FROM sessions WHERE expires_at < CURRENT_TIMESTAMP;

Removes rows matching WHERE.

Notes & Best Practices

Example

DELETE FROM sessions
WHERE expires_at < CURRENT_TIMESTAMP
RETURNING id;

Linked from

Related notes