SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Nov 2011
    Posts
    190
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Storing boolean values - which data type is best?

    I am trying to store boolean values along with the null value. I thought that tinyint(1) would be ideal, so that 0 means false and 1 means true. Am I on the right track here or should I be using another data type?

  2. #2
    SitePoint Addict
    Join Date
    Apr 2009
    Posts
    357
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I've used tinyint often for boolean storage for the same reason, to allow storing null as well as storing the boolean true/false
    Doug G
    =====
    "If you ain't the lead dog, the view is always the same - Anon

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,248
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by Doug G View Post
    ... to allow storing null as well as storing the boolean true/false
    awesome

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •