Gayner Posted September 27, 2009 Share Posted September 27, 2009 Im making a row on my table, but it's only to be used for 0 and 1, simple true and false 1 and 0 what type should i do that is the smallest most less performanced? a varchar(2)? or somethinG? Ty Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/ Share on other sites More sharing options...
.josh Posted September 27, 2009 Share Posted September 27, 2009 personally i'd go for tinyint Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-925730 Share on other sites More sharing options...
redarrow Posted September 27, 2009 Share Posted September 27, 2009 my choice ENUM('0','1') NOT NULL default '0' Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-925731 Share on other sites More sharing options...
.josh Posted September 27, 2009 Share Posted September 27, 2009 except that enum takes up more space by storing the possible values. Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-925738 Share on other sites More sharing options...
Gayner Posted September 27, 2009 Author Share Posted September 27, 2009 tiny it. thank u guys! Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-925742 Share on other sites More sharing options...
fenway Posted October 5, 2009 Share Posted October 5, 2009 Technically, CHAR(0) is the smallest you can use for storing booleans. Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-930743 Share on other sites More sharing options...
Mchl Posted October 5, 2009 Share Posted October 5, 2009 A column that is defined as CHAR(0) NULL occupies only one bit and can take only the values NULL and '' (the empty string). Wicked... but testing against '' and NULL can be quite counter intuitive... Wicked... Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-930747 Share on other sites More sharing options...
fenway Posted October 5, 2009 Share Posted October 5, 2009 Oh, it's pure evil.... I concur. It's more of a trivia question. Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-930753 Share on other sites More sharing options...
Mchl Posted October 5, 2009 Share Posted October 5, 2009 Why can't we have a real BOOL type Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-930761 Share on other sites More sharing options...
fenway Posted October 5, 2009 Share Posted October 5, 2009 Why can't we have a real BOOL type You mean one that isn't an alias to "TINYINT(1)"? Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-930763 Share on other sites More sharing options...
Mchl Posted October 5, 2009 Share Posted October 5, 2009 One that takes indeed one bit. I did some testing with BIT(1) but it just confuses me. Link to comment https://forums.phpfreaks.com/topic/175675-solved-smallest-mysql-type-php/#findComment-930772 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.