1、delete from + where 字句
题目:删除id=4的数据
mysql> select*from students;
+----+----------+-----+------+
| id | name | sex | age |
+----+----------+-----+------+
| 1 | kimi | f | 12 |
| 2 | hathway | m | 15 |
| 3 | tony | f | 15 |
| 4 | hongkong | m | 16 |
| 5 | wendy | m | 20 |
+----+----------+-----+------+
5 rows in set (0.00 sec)
mysql> delete from students where id =4;
Query OK, 1 row affected (0.00 sec)
mysql> select*from students;
+----+---------+-----+------+
| id | name | sex | age |
+----+---------+-----+------+
| 1 | kimi | f | 12 |
| 2 | hathway | m | 15 |
| 3 | tony | f | 15 |
| 5 | wendy | m | 20 |
+----+---------+-----+------+
4 rows in set (0.00 sec)
网友评论