DELETE
The DELETE statement removes rows from a table.
You can delete specific records or clear all data from a table while keeping its structure.
Basic Syntax
The example below shows how to delete a record from a table using the DELETE statement:
DELETE FROM table_name WHERE condition;
DELETE FROMspecifies the table.WHEREdefines which rows to remove.
Be careful: Omitting the
WHEREclause deletes every row in the table.
DELETE Statement Example
The query below deletes the record of the client named Jason Green.
DELETE FROM clients WHERE name = 'Jason Green';
This command deletes the record of the client named Jason Green.
Delete All Rows
To clear all data from a table but keep the table structure, you can use the following query:
DELETE FROM clients;
Note: this action cannot be undone unless a backup is available.
What is the main purpose of the DELETE statement in SQL?
To add a new column
To change data in a column
To remove records from a table
To create a new table
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Tables
Execution Result