SQL DELETE Statement
$count++; if($count == 1) { include "../mobilemenu.php"; } if ($count == 2) { include "../sharemediasubfolder.php"; } ?>
DELETE statement in SQL is used to delete records from Tables.
You can either DELETE a single record, or multiple records in a table.
You can specify which records to DELETE via a WHERE clause.
Syntax of DELETE Statement is as follows:
DELETE FROM TABLENAME WHERE condition
Imagine we have table called CUSTOMER, with the following data:
FIRSTNAME
LASTNAME
AGE
COUNTRY
Rambo
Robert
25
Belgium
Mugambo
Kichidi
37
Norway
Nagashekar
Rao
47
India
We can use a DELETE statement as follows.
DELETE FROM Customer WHERE FIRSTNAME='Rambo'
Result:
1 Row deleted. Table contents:
FIRSTNAME
LASTNAME
AGE
COUNTRY
Mugambo
Kichidi
37
Norway
Nagashekar
Rao
47
India
Scenario 2: Delete all records from Customer table
We can use a DELETE statement as follows.
DELETE * FROM CUSTOMER
Result:
2 Rows deleted. Table contents:
FIRSTNAME
LASTNAME
AGE
COUNTRY