MySQL - Delete Query
MySQL DELETE statement is used to delete a single record or multiple records from a table in MySQL.
SYNTAX
DELETE FROM table_name
WHERE condition;
First lets take a table with student details and check how DELETE works:
StudentId | Studentclass | Studentmarks |
---|---|---|
1 | fifth | 500 |
2 | sixth | 465 |
3 | seventh | 520 |
4 | eighth | 450 |
5 | ninth | 555 |
Example - With One condition
DELETE FROM studentinfo
WHERE Studentclass = 'eighth';
Result will be displayed as follows:
StudentId | Studentclass | Studentmarks |
---|---|---|
1 | fifth | 500 |
2 | sixth | 465 |
3 | seventh | 520 |
5 | ninth | 555 |
DELETE * FROM studentmarks
--------Result-------
# Before deleting system asks for the confirmation to delete or not.Then entire table gets deleted
MySQL - Grant_ Revoke Privilege
posted on 2019-11-26 23:15:04 - mysql Tutorials