您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

MySQL中多表操作和批处理方法(3)_MySQL

2025/12/24 8:57:29发布27次查看
3、增加记录
前面已经讲过如何增加一条记录,为便于查看,重复与此:
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的名字;
可以删除一个或多个表,小心使用。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product