Sunday, 7 May 2017

SQL Delete Statement

In this post, I will explain the SQL Delete Statement.

DELETE statement is used to delete a single or multiple rows from a table. We can use where clause with delete statement to delete selected row(s).

Few things to Note about Delete Statement -
1. Where clause with delete statement is optional
2. If where clause in a delete statement is not included, then all row(s) from table is deleted
3. If table row is referenced by foreign key, then row cannot be deleted
4. Delete operation on a table will not reset identity column counter
5. Delete operation cannot be rolled back if it is committed

Example -
DELETE FROM tbl_Employee
WHERE Id = 10

0 comments:

Post a Comment

Please do not enter any spam link in the message box.