Jump to content
Larry Ullman's Book Forums
Sign in to follow this  
Edward

Boolean

Recommended Posts

I have a status value which i need to store in my database, either a 0 or 1, could anyone suggest the best data type for this with some reason. I noticed boolean would that be a good choice if not why?

Share this post


Link to post
Share on other sites

Well after saving my data as Boolean the value in MySQL actually showed as a tinyint(1), well unless any of you suggest something better i see no reason in not going with that.

Share this post


Link to post
Share on other sites

Yeah, so MySQL doesn't actually have a Boolean type, it just uses 1/0 internally. That's the argument against using Boolean.

  • Upvote 1

Share this post


Link to post
Share on other sites

I guess is doesn't but i found BOOLEAN in a drop down list when i was adding a new column to one of my tables in PhpMyAdmin, but after the column was created it showed tinyint(1) as i earlier stated.

Share this post


Link to post
Share on other sites

I like using the enum type, which is very simple and best used when you are certain additional values will not be required. Would you say this field type is a good performer?

Share this post


Link to post
Share on other sites

Well these systems now can handle millions of records with no bother as you did state before, so if its something that is perform related we can worry about that if our sites are ever to become that busy, which looks highly unlikely with all the competition out there. Anyway there is no harm in trying, gives us something to keep us busy.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...