一、MySQL 的 boolean 和 tinyint(1):
boolean类型MYSQL保存BOOLEAN值时用1代表TRUE,0代表FALSE,boolean在MySQL里的类型为tinyint(1),MySQL里有四个常量:true,false,TRUE,FALSE,它们分别代表1,0,1,0,mysql> select true,false,TRUE,FALSE;+------+-------+------+-------+| TRUE | FALSE | TRUE | FALSE |+------+-------+------+-------+| 1 | 0 | 1 | 0 |+------+-------+------+-------+可以如下插入boolean值:insert into [xxxx(xx)] values(true),当然也可以values(1);
举例如下:mysql> alter table test add isOk boolean;Query OKmysql> desc test;+-------+-------------+------+-----+---------+----------------+| Field | Type | Null | Key | Default | Extra |+-------+-------------+------+-----+---------+----------------+| id | int(11) | NO | PRI | NULL | auto_increment || isOk | tinyint(1) | YES | | NULL | |+-------+-------------+------+-----+---------+----------------+mysql> insert into test(isOk) values(true);Query OKmysql> select isOk from test ;+------+| isOk |+------+| 1 |+------+=================
create table xs ( id int primary key, bl boolean ) |
rowNum就是排序序号。