Sunday, 16 June 2013

How to delete record from a table

The DELETE statement is used to delete records in a table.
The DELETE statement is used to delete records in a table.


The SQL DELETE Statement

The DELETE statement is used to delete rows in a table.

SQL DELETE Syntax

DELETE FROM table_name
WHERE some_column=some_value;


Suppose  we want  to delete  a record from the table name "Customer";

We use the following SQL statement:

DELETE FROM Customer
    WHERE CustomerName='Albert discotsa' AND ContactName='Maria';

Delete All Data

      It is possible to delete all the record from  table without deleting the table. This means
      that the  table structure , attributes, and indexes will be intact:
DELETE FROM table_name;

or

DELETE * FROM table_name;

             Note: please be cautious while you delete the complete record  because You cannot undo   this     statement!


0 comments:

Post a Comment