5.6 Column Attribute
来源:互联网 发布:太阳能发电原理知乎 编辑:程序博客网 时间:2024/05/17 02:09
5.6.1 Numeric Column Attribute
Numeric 数据类型而不是BIT可能有一下的属性:
1.UNSIGNED负值被忽略
2.ZEROFILL引发获取的值左边被添加前导0到列展示的宽度。例如,如果存储0,14和1234在列上,被定义 INT(5) zerofill,mysql展示他们作为00000,00014,和01234
3.AUTO_INCREMENT应用于整形数据类型,它被使用来产生连续唯一的值
5.6.2 String Column Attribute
1. CHARACTER SET指定字符集和,
2. COLLATE指定set collation集合
3.Binary是缩写对于指定二进制集合,BINARY属性和BINARY 数据类型是不同的,前者设定结婚对于一个非二进制字符串列,后者创建一个二进制字符串列。
使用binary属性将引发char varchar text非二进制的字符串类型被创建使用binary,varbinary和blob二进制类型
5.6.3 一般的列属性
1.NULL 和NOT NULL
2.DEFAULT ,如果指定一个默认值NULL到非空的列会产生错误
3.默认值越界超出了数据类型,例如一个负值对于unsigned数值列
数值型的默认值是0,字符串是空字符串,日期类型是00:00:00
5.7 使用AUTO_INCREMENT column Attribute
AUTO_INcrement属性可能必须不为空,MYSql也提供last——inset——id()函数来返回最近产生的auto——increment值。这个值返回有last——insert——id()。
对于定义auto——increment下面的语句等效:
insert into t (id,name) values(null,'hans');
insert into t(name) values('Hans');
insert into t(id) values(NULL),(NULL),(17),(NULL),(NULL)
id
1
2
17
18
19
Auto_increment列被设置NULL它将被设置为下个序列的值,这可能被发送如果替换列为0除非使用NO_AUTO_VALUE_ON_ZERO
当达到上限时,将产生重复键值错误
如果你删除含有值的的行,当插入新的行是不会被重用,如:1 to 10行,当删除记录包含10的,下个序列是11而不是10(myisam,innodb)
对于mysql> create table multisequece(
-> name char(10) not null,
-> name_id int unsigned not null auto_increment,
-> primary key (name, name_id)
-> );
ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
- 5.6 Column Attribute
- Attribute view add column
- Attribute "column" must be declared for element type "property"解决办法
- Attribute "column" must be declared for element type "property"解决办法
- Attribute "column" must be declared for element type "property"解决办法
- Attribute
- Attribute
- attribute
- attribute
- attribute
- attribute
- attribute
- attribute
- Attribute
- Attribute
- Attribute
- Attribute
- ORA-22913: must specify table name for nested table column or attribute
- 分治
- 数据库集群
- Git 使用教程
- Canvas之基本形状操作
- Java中Boolean与boolean的区别
- 5.6 Column Attribute
- cc254x的外部32.768k晶振
- IR的设计
- java基础1
- 【java并发】条件阻塞Condition的应用
- Android 创建第一个jni文件
- JavaScript中函数的定义方式
- php 数组操作(jcxn实践)
- 浅谈Android和java中的多线程下载