SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: ENUM in MySQL.

Hybrid View

  1. #1
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    ENUM in MySQL.

    I have a field in a table that decides in a particular record is to be included in results for a particular area.

    Basically, the table is holding details of venues that people can visit. I'm developing two sites, one for tourists and one for businesses looking for conference venues.

    Since most details are identical, it made sense to have all venues in one table. All venues will be included on the business site, but only a portion on the tourism site. I have added a field that initially was going to contain 0 or 1, 1 denoting that the record in question is a valid "touristy" record.

    Then I remembered enum, which I have never used before. Would that be more appropriate in this instance, and if so, why?

    If anyone is a datatype guru, I'd really appreciate a little guidance here!

    Thanks,

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS

  2. #2
    SitePoint Guru
    Join Date
    Jan 2001
    Location
    Alkmaar, Netherlands
    Posts
    710
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Actually 1 or 0 is good if your column name is enabled or disabled. Which means you will not add anymore values to it.

    Only drawback is that if you want that colum hold more than one meaning.
    Something like enabled, disabled, waitingforconfirmation, deleted(this means deleted virtually but waiting for confirmation for final deletion)

    if you dont expect column contain more than 2 values then keep your 1/0. IMHO

  3. #3
    SitePoint Wizard silver trophy TheOriginalH's Avatar
    Join Date
    Aug 2000
    Location
    Thailand
    Posts
    4,810
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Excellent, that works for me!

    Thank you.

    H
    ~The Artist Latterly Known as Crazy Hamster~
    922ee590a26bd62eb9b33cf2877a00df
    Currently delving into Django, GIT & CentOS


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
  •