Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. MySQL: best for true or false, Yes or No, negative or positive

MySQL: best for true or false, Yes or No, negative or positive

Scheduled Pinned Locked Moved Database
mysqlcomquestionannouncement
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    hi, I want to have fields in MySQL such as is_administrator, is_active, is_blocked which will be true or false, yes or no, negative or positive, or whatever name you'll use for it.. I would like to ask what's the best field type to use for such requirment? Thanks, Jassim

    Technology News @ www.JassimRahma.com

    J L 2 Replies Last reply
    0
    • J Jassim Rahma

      hi, I want to have fields in MySQL such as is_administrator, is_active, is_blocked which will be true or false, yes or no, negative or positive, or whatever name you'll use for it.. I would like to ask what's the best field type to use for such requirment? Thanks, Jassim

      Technology News @ www.JassimRahma.com

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #2

      Depends on your version. But I'd suggest bool, bit or tinyint, depending on availability in your version.

      Wrong is evil and must be defeated. - Jeff Ello[^]

      1 Reply Last reply
      0
      • J Jassim Rahma

        hi, I want to have fields in MySQL such as is_administrator, is_active, is_blocked which will be true or false, yes or no, negative or positive, or whatever name you'll use for it.. I would like to ask what's the best field type to use for such requirment? Thanks, Jassim

        Technology News @ www.JassimRahma.com

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Jassim Rahma wrote:

        I would like to ask what's the best field type to use for such requirment?

        What's the reason you're asking? In MySQL[^], TINYINT(1) = BOOLEAN = BIT

        A value of zero is considered false. Nonzero values are considered true.

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups