温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

mysql增删改查

发布时间:2020-06-13 11:25:52 来源:网络 阅读:521 作者:echoroot 栏目:MySQL数据库


  • 创建数据表:

mysql> use simonwang

Database changed

mysql> show tables;

Empty set (0.00 sec)

mysql> create table t1 (`id` int(4), `name` char(40));

Query OK, 0 rows affected (0.01 sec)

  • 插入数据:

mysql> insert into studytable values(1,'test');

Query OK, 1 row affected (0.00 sec)

mysql> select * from studytable;

+------+------+

| id   | name |

+------+------+

|    1 | test |

+------+------+

1 row in set (0.00 sec)

  • 修改数据:

mysql> update studytable set name='updatetest' where id='1';

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> select * from studytable;

+------+------------+

| id   | name       |

+------+------------+

|    1 | updatetest |

+------+------------+

1 row in set (0.00 sec)

  • 清空数据表:

mysql> truncate table studytable;

Query OK, 0 rows affected (0.00 sec)

mysql> select * from studytable;

Empty set (0.00 sec)

  • 删除数据表

mysql> drop table studytable;

Query OK, 0 rows affected (0.00 sec)

  • 删除数据库:

mysql> drop database simonwang;

Query OK, 0 rows affected (0.01 sec)



向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI