- 2
- 0
- 约1.52千字
- 约 10页
- 2021-07-27 发布于境外
- 举报
欧阳美创编
用MySQL创建数据库和数据表:
时间:2021.01.01
创作:欧阳美
步骤:
1、 使用show语句找出在服务器上当前存在什么数据库: mysqlshow databases;
2、 创建一个数据库test:
mysqlcreate database test;
3、 选择你所创建的数据库:
mysqluse test;
4创建一个数据表:
首先查看刚才创建的数据库中存在什么表:
mysqlshow tables;
(说明刚才创建的数据库中还没有数据库表)
接着我们创建一个关于students的数据表:包括学生的学 号(id),姓名(name),性别(sex),年龄(age)。
mysqlcreate table students (id int unsigned not null auto_increment primary key,name char(8) not null,sex char(4) not null,age tinyint unsigned not null,); 解释: 以 id int unsigned not null auto_increment primary key行进行介绍:id为列的名称;
指定该列的类型为int (取值范围为-8388608到 8388607),在后面我们又用unsigned加以修饰,表示 该类型为无符号型,
原创力文档

文档评论(0)