SQL Delete Query - Delete Statement in SQL
Demo wikitechydatabase
- Below is a selection from the wikitechytable table used in the examples:
The SQL DELETE Statement
- The DELETE statement is used to delete existing records in a table.
DELETE Syntax
DELETE FROM table_name WHERE condition;
Note: Be careful when deleting records in a table! Notice the WHERE clause in the DELETE statement. The WHERE clause specifies which record(s) should be deleted. If you omit the WHERE clause, all records in the table will be deleted!
SQL DELETE Example
- The following SQL statement deletes the name "Sharuk" from the "wikitechytable" table:
DELETE FROM wikitechytable WHERE name = 'Sharuk';
Output
Delete All Records
- It is possible to delete all rows in a table without deleting the table. This means that the table structure, attributes, and indexes will be intact:
DELETE FROM wikitechytable