SQL -Structured Query Language - SQL Delete - Delete Table Tutorial
To delete only the record of the existing created table with a special condition. Then we can use a ' DELETE TABLE ' statement.
Syntax-
The basic syntax of the DELETE TABLE statement is given below –
DELETE FROM table_name where [CONDITION];
For example-
DELETE FROM regions WHERE region_id = 1;
Here regions is a table name and region_id is column_name.
In this statement, we have given a condition region_id = 1. Hence it will delete only records whose region_id=1 from the regions table.
But if we do not include the where condition in the statement.
Then it will delete all the records of the regions table.
Syntax-
DELETE FROM table_name;
For example-
DELETE FROM regions;
This statement will work similarly to a truncate statement. The only difference is that the delete statement will not free up space while the truncate will free up space.