SQL DELETE Statement

Friday, October 28, 2011

tags SQL

The DELETE statement is used to delete rows in a table. The WHERE clause should always be used in conjunction with the DELETE statement. The WHERE clause specifies which record or records that should be deleted. If you omit the WHERE clause, all records in the table will be deleted.


SQL DELETE Syntax

DELETE FROM table_name
WHERE some_column=some_value

SQL DELETE Example

employeeIDemployeeName
1000John Smith
1001Fred White
1002Jane Scott
1003Samuel Williams


DELETE FROM tbl_employees
WHERE employeeID=1000


Deleting All Rows

It is possible to delete all rows in a table without deleting the table itself.

DELETE FROM table_name

or

DELETE * FROM table_name

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

SQL Cookbook Head First SQL: Your Brain on SQL A Learners Guide