前面已經講過如何增加一條記錄,為便於查看,重復與此:
MySQL> insert into mytable
-> values (′abc′,′f′,′1966-08-17′,′china′,′n′);
Query OK, 1 row affected (0.05 sec)
查看一下:
MySQL> select * from mytable;
+----------+------+------------+-----------+--------+
| name | sex | birth | birthaddr | single |
+----------+------+------------+-----------+--------+
| abccs | f | 1977-07-07 | china | y |
| mary | f | 1978-12-12 | usa | NULL |
| tom | m | 1970-09-02 | usa | NULL |
| abc | f | 1966-08-17 | china | n |
+----------+------+------------+-----------+--------+
4、刪除記錄
用如下命令刪除表中的一條記錄:
MySQL> delete from mytable where name=′abc′;
DELETE從表中刪除滿足由where給出的條件的一條記錄。
再顯示一下結果:
MySQL> select * from mytable;
+----------+------+------------+-----------+--------+
| name | sex | birth | birthaddr | single |
+----------+------+------------+-----------+--------+
| abccs | f | 1977-07-07 | china | y |
| mary | f | 1978-12-12 | usa | NULL |
| tom | m | 1970-09-02 | usa | NULL |
+----------+------+------------+-----------+--------+
5、刪除表:
MySQL> drop table ****(表1的名字),***表2的名字;
可以刪除一個或多個表,小心使用。