How to Delete Data using SQL

How to Delete Data using SQL

If much of that data consists of rows that you will probably never need to access again, it makes sense to get rid of it. The DELETE statement is used to delete existing records in a table.

DELETE FROM table_name WHERE condition;

The WHERE clause specifies which records should be deleted. If you omit the WHERE clause, all records in the table will be deleted.

You can delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact.

DELETE FROM table_name;