Using 1 and 0s

Discussion in 'MySQL' started by bkflash, Dec 13, 2006.

  1. #1
    I just installed mysql and im making my database, but ive come upon a problem, i want to store users information in the database based on 1 or 0 , i was looking at using int as my type, but then i wondered if there was a type that would only allow 1s or 0s to be inserted as its value, im trying to make it so in the user's profile 1 equals true and 0 equals false, anybody know a proper way to do this?
     
    bkflash, Dec 13, 2006 IP
  2. JoshuaGross

    JoshuaGross Peon

    Messages:
    411
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #2
    ENUM(0,1)

    or TINYINT(1)
     
    JoshuaGross, Dec 13, 2006 IP
  3. Austars

    Austars Active Member

    Messages:
    1,437
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    95
    #3
    Yes, TINYINT(1) will be basically a "bool/boolean" ;)
     
    Austars, Dec 13, 2006 IP
  4. falcondriver

    falcondriver Well-Known Member

    Messages:
    963
    Likes Received:
    47
    Best Answers:
    0
    Trophy Points:
    145
    #4
    and why dont u use "BOOL" as datatype in this case? :confused:
     
    falcondriver, Dec 14, 2006 IP
  5. technoguy

    technoguy Notable Member

    Messages:
    4,369
    Likes Received:
    306
    Best Answers:
    0
    Trophy Points:
    205
    #5
    I would prefer Yes, TINYINT(1) too.
     
    technoguy, Dec 14, 2006 IP
  6. vitaminp

    vitaminp Peon

    Messages:
    202
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #6
    id use BOOL
     
    vitaminp, Dec 16, 2006 IP