Jump to content
  • Advertisement
Sign in to follow this  
HumanoidTyphoon

Mysql Boolean Datatype

This topic is 3993 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Looking for a datatype to use as a boolean It suggests tinyint however its range does not correlate to a boolean. I tried to use a set with "Y","N" being the only options and Nulls disallowed. However if you do not specify one of those options an empty string is input. Even when the defauly value is "y". The data in those rows HAS to be THIS or THAT. Nulls, empty strings, and other values should not be possible. Does anyone know what i could use? If i could get a datatype that only accepts 1's and 0's only then that would do nicely. Thanks

Share this post


Link to post
Share on other sites
Advertisement
It won't make a lot of difference to the execution speed. Just use a tinyint(1), or a single char with a constraint to y or n. (I beleive mysql supports enum data types, so try using

foo ENUM ('y','n') NOT NULL


)


Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!