Home >Database >Mysql Tutorial >mysql的boolean设置_MySQL

mysql的boolean设置_MySQL

WBOY
WBOYOriginal
2016-06-01 13:34:071450browse

bitsCN.com

mysql的boolean设置

 

 MySQL没有boolean类型。这也是比较奇怪的现象。例:

 

create table xs

(

   id int primary key,

   bl boolean

)

 

这样是可以创建成功,但查看一下建表后的语句,就会发现,mysql把它替换成

 

tinyint(1)。也就是说mysql把boolean=tinyInt了。 

 

boolean类型

 

MYSQL保存BOOLEAN值时用1代表TRUE,0代表FALSE,boolean在MySQL里的类型为tinyint(1),

MySQL里有四个常量:true,false,TRUE,FALSE,它们分别代表1,0,1,0

 

bitsCN.com
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn