目錄
題目:
解答:
題目:
英雄表(hero)
主鍵
name
nickname
address
groups
telephone
解答:
第一步:
進(jìn)入數(shù)據(jù)庫(kù)
[root@localhost ~]# mysql -uroot -pAdmin123!
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql8.0 [(none)]>
第二步:
創(chuàng)建數(shù)據(jù)庫(kù)并使用
mysql8.0 [(none)]>create database zuoye;
Query OK, 1 row affected (0.00 sec)
mysql8.0 [(none)]>use zuoye;
Database changed
mysql8.0 [zuoye]>
第三步:
創(chuàng)建表hero?
mysql8.0 [zuoye]>create table hero(
-> id int auto_increment primary key,
-> name varchar(255) not null,
-> nickname varchar(255),
-> address varchar(255),
-> group_ varchar(255),
-> email varchar(255),
-> telephone int
-> );
Query OK, 0 rows affected (0.01 sec)
第四步:
向表中添加數(shù)據(jù)
mysql8.0 [zuoye]>insert into hero values
-> ('宋江','及時(shí)雨','宋家村','水滸傳','5968423@qq.com',12345678932),
-> ('孫悟空','齊天大圣','花果山','西游記','9512368@qq.com',96325874156),
-> ('吳用','智多星','吳家莊','水滸傳','85215694@qq.com',75321469854),
-> ('諸葛亮','孔明','蜀國(guó)','三國(guó)演義','3854236@qq.com',85214796354);
Query OK, 4 rows affected (0.00 sec)
Records: 4 Duplicates: 0 Warnings: 0
第五步:文章來源:http://www.zghlxwxcb.cn/news/detail-808555.html
查看數(shù)據(jù)文章來源地址http://www.zghlxwxcb.cn/news/detail-808555.html
mysql8.0 [zuoye]>select * from hero;
+----+-----------+--------------+-----------+--------------+-----------------+------------+
| id | name | nickname | address | group_ | email | telephone |
+----+-----------+--------------+-----------+--------------+-----------------+------------+
| 1 | 宋江 | 及時(shí)雨 | 宋家村 | 水滸傳 | 5968423@qq.com |12345678932 |
| 2 | 孫悟空 | 齊天大圣 | 花果山 | 西游記 | 9512368@qq.com | 96325874156|
| 3 | 吳用 | 智多星 | 吳家莊 | 水滸傳 | 85215694@qq.com | 75321469854|
| 4 | 諸葛亮 | 孔明 | 蜀國(guó) | 三國(guó)演義 | 3854236@qq.com |85214796354 |
+----+-----------+--------------+-----------+--------------+-----------------+------------+
4 rows in set (0.00 sec)
到了這里,關(guān)于英雄表的創(chuàng)建 -- MySQL(2)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!