capypad
0 day streak
sql / beginner
Snippet

Deleting Data

The DELETE statement removes rows from a table. Similar to UPDATE, the WHERE clause is vital to prevent accidentally deleting all data in the table.

snippet.sql
sql
1
2
DELETE FROM customers
WHERE last_login < '2023-01-01';
Breakdown
1
DELETE FROM customers
Specifies the table from which records will be removed.
2
WHERE last_login < '2023-01-01'
Filters for records where the login date is before the specified year.