一、创建英雄表(hero)
mysql> use db_han
Database changed
mysql> create table hero(
-> name varchar(20) primary key,
-> nickname varchar(20),
-> address varchar(20),
-> `groups` varchar(20),
-> emile int,
-> telephone int);
Query OK, 0 rows affected (0.03 sec)
二、插入数据
mysql> insert into hero values("宋江","呼保义","水浒传","北宋",1231,1232);
Query OK, 1 row affected (0.01 sec)
mysql> insert into hero values("卢俊义","玉麒麟","水浒传","北宋",3211,33232);
Query OK, 1 row affected (0.01 sec)
mysql> insert into hero values("吴用","智多星","水浒传","山东",7894,4789);
Query OK, 1 row affected (0.00 sec)
mysql> insert into hero values("菩萨","观音","西游记","天庭",4561,1654);
Query OK, 1 row affected (0.01 sec)
mysql> insert into hero values("姜子牙","姜太公","封神英雄","商朝",3265,,5612);
Query OK, 1 row affected (0.01 sec)
mysql> insert into hero values("姬发","三公子","封神英雄","商朝",2255,525522);
Query OK, 1 row affected (0.00 sec)
mysql> insert into hero values("孙悟空","齐天大圣","西游记","花果山",99666,6699);
Query OK, 1 row affected (0.00 sec)
mysql> insert into hero values("哪吒","那拏天","封神英雄","商朝",4466,62644);
Query OK, 1 row affected (0.00 sec)
mysql> insert into hero values("林冲","豹子头","水浒传","东京",4587,7854);
Query OK, 1 row affected (0.01 sec)
mysql> insert into hero values("司马懿","司马老贼","三国演义","三国",99822,2299);
Query OK, 1 row affected (0.01 sec)
文章来源:https://www.toymoban.com/news/detail-798121.html
三、显示表中所有数据
文章来源地址https://www.toymoban.com/news/detail-798121.html
到了这里,关于MySQL创建表及插入数据的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!