To delete records from a MySQL table, you use the ‘DELETE’ statement.
Syntax:
DELETE FROM table_name WHERE condition;
- ‘table_name’: The name of the table from which you want to delete records.
- ‘WHERE condition’: An optional clause that specifies which records to delete. If omitted, all records in the table will be deleted.
Example:
DELETE FROM employees WHERE employee_id = 1;
This example deletes the record with ‘employee_id’ equal to 1 from the employees table.
All Record Delete in employee table:
DELETE FROM employees;