Deleting Data in MySQL
Deleting Data in MySQL
To delete data in the MySQL database we can use the DELETE statement.
Query:
Let's assume we want to delete the second employee "Maxon" from the "Employees" Table. We will use the DELETE clause delete with the WHERE clause to specify which data is being deleted.
employeeID | firstname | lastname | joining_date | |
1 | Maxon | Codes | maxon@codes.com | 2024-07-07 14:54:58 |
2 | Kapil | Dev | sonu@codes.com | 2024-07-07 15:44:51 |
Example:
After deleting, this is how our table will look.
employeeID | firstname | lastname | joining_date | |
1 | Maxon | Codes | maxon@codes.com | 2024-07-07 14:54:58 |