Skip to main content
Practice

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 Syntax
DELETE FROM table_name
WHERE condition;
  • DELETE FROM specifies the table.
  • WHERE defines which rows to remove.

Be careful: Omitting the WHERE clause deletes every row in the table.


DELETE Statement Example

The query below deletes the record of the client named Jason Green.

Delete a client by name
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 all records
DELETE FROM clients;

Note: this action cannot be undone unless a backup is available.

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.