The delete statement is used to delete records or rows from the table.
delete from "tablename" where "columnname" OPERATOR "value" [and|or "column" OPERATOR "value"]; [ ] = optional
[The above example was line wrapped for better viewing on this Web page.]
delete from employee;
Note: if you leave off the where clause, all records will be deleted!
delete from employee where lastname = 'May';
delete from employee where firstname = 'Mike' or firstname = 'Eric';
To delete an entire record/row from a table, enter
delete from followed by the table name, followed by the where
clause which contains the conditions to delete. If you leave off the
where clause, all records will be deleted.
Delete statement exercises
(Use the select statement to verify your deletes):
- Jonie Weber-Williams just quit, remove her record from the table.
delete from myemployees where lastname = 'Weber-Williams'; select * from myemployees;
- It’s time for budget cuts. Remove all employees who are making over 70000 dollars.
delete from myemployees where salary > 70000; select * from myemployees;
Create at least two of your own delete statements, and then issue a command to delete all records from the table.
Results will be displayed here