SQL Delete Statement
We can delete existing records in a tables using Delete statement.
Example:
DELETE FROM table_name
WHERE some_column=some_value
Delete Example:
Now we will delete records in following table
| ID | Category | Author | Tutorial |
| 1 | PHP | Hassan | what is php |
| 2 | MySql | James | what is sql |
| 3 | Ajax | Andrew | what is ajax |
| 4 | ASP | James | ASP Introduction |
| 5 | C++ | Andrew | C++ Basics |
| 6 | Java | John | what is java |
| 7 | CSS | Williams | css introduction |
DELETE FROM tutorials
WHERE Author='Andrew' AND Caetgory='C++'
WHERE Author='Andrew' AND Caetgory='C++'
| ID | Category | Author | Tutorial |
| 1 | PHP | Hassan | what is php |
| 2 | MySql | James | what is sql |
| 3 | Ajax | Andrew | what is ajax |
| 4 | ASP | James | ASP Introduction |
| 6 | Java | John | what is java |
| 7 | CSS | Williams | css introduction |
It is possible to delete all rows in a table without table deleting. This means that the table structure, attributes, and indexes will be intact only all records will be delete:
DELETE from table_name
Note: Be careful when you are deleting records, you can recover these records.