faqts : Computers : Databases : MySQL : Language and Syntax : Field Types

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

238 of 281 people (85%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

Is there a BOOLEAN type in MySQL?
How can I create a column with a boolean type?

Feb 18th, 2006 11:50
J T, Nathan Wallace, Paul DuBois, Sasha Pachev


ENUM('Y', 'N') will do the trick in some cases, and in others you
can use tinyint.

-------------------------------------------------

It's best to follow SQL standards wherever possible. Which is to use 
BOOLEAN keyword.

"BOOL, BOOLEAN 

These types are synonyms for TINYINT(1). A value of zero is considered 
false. Non-zero values are considered true. 

In the future, full boolean type handling will be introduced in 
accordance with standard SQL."

From MySQL 5.0 Manual.
http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.html