MySQL Tutorial
MySQL DELETE statement is used to delete data from the MySQL table within the database.
By using delete statement, we can delete records on the basis of conditions.
DELETE FROM table_name
WHERE (Condition specified);
This table named Students in our database that contains the following records:
ROLL_NO | NAME | SUBJECT |
---|---|---|
1 | Will | C++ |
2 | SAM | Python |
3 | Sara | HTML | 4 | Rim | Java |
5 | Micheal | SQL |
6 | Lara |
Let's check out some examples that demonstrate how it actually works
DELETE FROM Students
WHERE ROLL_NO = 6;
The following MySQL statement will Delete the record of student with ROLL_N0 = '6'
After execution, the resulting table will look something like this:
ROLL_NO | NAME | SUBJECT |
---|---|---|
1 | Will | C++ |
2 | SAM | Python |
3 | Sara | HTML | 4 | Rim | Java |
5 | Micheal | SQL |