MySQL 语句入门 数据库 概念 4 增删改查语句介绍 整形列的字节与存储范围 5 6 7 浮点列 整形列的可选属性 8 字符型列 日期时间列类型 9 10 11 ID: 792780
Download The PPT/PDF document "MySQL 基础教程 1 2 3" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Slide1
MySQL
基础教程
Slide21
2
3
MySQL
语句入门
数据库
概念
4
增删改查语句介绍
整形列的字节与存储范围
Slide35
6
7
浮点列
整形列的可选属性
8
字符型列
日期时间列类型
Slide49
10
11
增删改查语法详解
建表案例
12
安装
ecshop
与
phpMyAdmin
阶段总结
一
Slide5第五讲
-整形列的可选属性
tinyint可选参数介绍:tinyint(M) unsigned zerofill注释
:1、tinyint默认为无符号数2、
M: 宽度,在zerofill填充的时候才有意义3、unsigned: 无符号类型(非负),影响存储范围
4、zerofill: 零填充,如果某列zerofill,默认就是unsigned
Slide6第五讲
-整形列的可选属性-unsigned
练习题:在class表中添加一个名为
age2的列,类型为tinyint unsigned,插入数值256,-5,255
,看是否成功答案:alter
table class add age2 tinyint unsigned;//
在表class中添加一列age2,tinyint为unsigned。insert into class (name, age, age2) values (‘lisi’,25,256);
//age2的范围为0-255,故256插入失败,同理,下面语句的-5也插入失败insert into class (name, age, age2) values (‘lisi’,25,-5);//失败
insert into class (name, age, age2) values (‘lisi’,25,255);//成功
Slide7第五
讲-整形列的可选属性
-M练习题:在class表中添加一个列age3
,类型为tinyint(1)
答案: alter table class add age3 tinyint(1);
Slide8第
五讲-整型列的可选属性
-M练习题:在class表中添加一个列
age4,类型为tinyint(5) zerofill
答案:
alter table class add age4 tinyint(5) zerofill;
Slide9第五讲
-整形列的可选属性
答案:insert into class (name,age4) values (‘zhaoliu’,9);//age4占用的字符为5
个,当插入的数据为一位的时候,前面4位补零
练习题:在表class中,向name列和age4列插入数值,age 为
9,查看age4的显示