About Lesson
DELETE
The DELETE statement is used to delete rows in a table.
Syntax:
DELETE FROM table_name
WHERE some_column=some_value
DELETE FROM table_name
WHERE some_column=some_value
DELETE FROM table_name WHERE some_column=some_value
Note! Notice the WHERE clause in the DELETE syntax. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records will be deleted!
Example:
delete from CUSTOMER where CustomerId=2
delete from CUSTOMER where CustomerId=2
delete from CUSTOMER where CustomerId=2
Before Delete:
After Delete:
Delete All Rows:
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 table_name
DELETE FROM table_name
DELETE FROM table_name
Note! Make sure to do this only when you really mean it! You cannot UNDO this statement!
Delete Data in the Designer Tools:
You delete data in the designer by right-click on the row and select “Delete”: