stonelord Posted June 24, 2008 Share Posted June 24, 2008 Hi, I have been tryoing to read but I can't seem to find a good answer. What is the best data type in mysql to use for a field in my database that I want to receive a "yes" or "no" answer? or "true" or "false"? I read that 'Enum' may be one of them because I don't see 'Boolean'!!! Please help, thank you Quote Link to comment Share on other sites More sharing options...
gijew Posted June 24, 2008 Share Posted June 24, 2008 If I want true or false I usually use an INT field type and set it to 0 (false) or 1 (true). Enum works as well because it allows options so you could just put in ('true','false') as the defaults. Quote Link to comment Share on other sites More sharing options...
clearstatcache Posted June 24, 2008 Share Posted June 24, 2008 You may use tinyint length = 1 Quote Link to comment Share on other sites More sharing options...
clearstatcache Posted June 24, 2008 Share Posted June 24, 2008 You may use tinyint length = 1. 1 for true and 0 for false Quote Link to comment Share on other sites More sharing options...
dannyb785 Posted June 24, 2008 Share Posted June 24, 2008 ^ and ^^ ditto. Tinyint is what i do.or maybe varchar with length 1(but I dont do that, I dunno which takes up more space) Quote Link to comment Share on other sites More sharing options...
fenway Posted June 24, 2008 Share Posted June 24, 2008 There's a BIT field, too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.