Deleting Rows in SQL

by Dinesh 2012-08-27 17:32:25

Deleting Rows in SQL
The SQL Delete command is used to change data in your SQL database.

Syntax:
Delete from tablename
where fieldname =/<>/ ... value
and/or ...
fieldname =/<>/ ... value
and/or
fieldname =/<>/ ... value

Explanation:
01. If you do not include a Where clause, all of the rows in the table will be deleted.

02. Every table has a primary key -- a field or combination of fields that uniquely identify each row in the table. VendId is the primary key for the vendor table. Each vendor is uniquely identified by the vendor Id. RefNbr is the primary key for APDoc.

03. If you want to delete a single row of data, you can refer to the row in the Where clause by using the primary key.

04. When deleting data, use the Start Transaction command so that any errors can be rolled back.

05. Use the Rollback Work command to undo changes.

06. Use the Commit Work command to finalize changes.
892
like
0
dislike
0
mail
flag

You must LOGIN to add comments