1To delete data from a table, you use the MySQL DELETE statement. The following illustrates the syntax of the DELETE statement:
2
3DELETE FROM table_name
4WHERE condition;
5In this statement:
6
7First, specify the table from which you delete data.
8Second, use a condition to specify which rows to delete in the WHERE clause. The DELETE statement will delete rows that match the condition,
1[CONSTRAINT [symbol]] FOREIGN KEY
2 [index_name] (col_name, ...)
3 REFERENCES tbl_name (col_name,...)
4 [ON DELETE reference_option]
5 [ON UPDATE reference_option]
6
7reference_option:
8 RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT
1start transaction;
2
3savepoint sp1;
4
5delete from customer where ID=1;
6
7savepoint sp2;
8
9delete from customer where ID=2;
10
11rollback to sp2;
12
13rollback to sp1;