The “Delete” statement is used to delete records (all or selected) in a table.
Syntax:
DELETE FROM <Table
name>
WHERE SomeColumn=SomeValue
Note:
Using where clause we can delete specific records. If we remove “Where” clause
all records will be deleted.
Example:
Specific record deletion:
The
table Sample_Table is having six records.
I
want to delete a record which is having ID value 104.
SQL statement:
DELETE FROM Sample_Table
WHERE ID=104
Result: SELECT
* FROM
Sample_Table
The
record (104) is deleted from the table.
Delete all records:
DELETE FROM Sample_Table
Result: SELECT
* FROM
Sample_Table
All records deleted.
No comments:
Post a Comment