<< previous page   --   table of contents   --   next page >>
| | | | | | | |
  • Return to Table of Contents
  • Table of Contents

    1. General Information
    2. MySQL Installation
    3. Tutorial Introduction
    4. Database Administration
    5. MySQL Optimisation
    6. MySQL Language Reference
    7. MySQL Table Types
    8. MySQL APIs
    9. Extending MySQL

    Chapter 6:  MySQL Language Reference 403 If  you  retrieve  an  ENUM  in  a  numeric  context,  the  column  value's  index  is  returned.   For example, you can retrieve numeric values from an ENUM column like this: mysql> SELECT enum_col+0 FROM tbl_name; If you store a number into an ENUM, the number is treated as an index, and the value stored is the enumeration member with that index.  (However, this will not work with LOAD DATA, which treats all input as  strings.)   It's not advisable to store  numbers  in an  ENUM  string because it will make things confusing. ENUM values are sorted according to the order in which the enumeration members were listed in the column speci cation.  (In other words, ENUM values are sorted according to their index numbers.)  For example, "a" sorts before "b" for ENUM("a", "b"), but "b" sorts before "a" for ENUM("b", "a").  The empty string sorts before non-empty strings, and NULL values sort before all other enumeration values. If you want to get all possible values for an  ENUM  column, you should use:  SHOW COLUMNS FROM table_name LIKE enum_column_name and parse the ENUM de nition in the second col- umn. 6.2.3.4  The SET Type A SET is a string object that can have zero or more values, each of which must be chosen from a list of allowed values speci ed when the table is created.   SET  column values that consist of multiple set members are speci ed with members separated by commas (`,').  A consequence of this is that SET member values cannot themselves contain commas. For  example,  a  column  speci ed  as  SET("one", "two") NOT NULL  can  have  any  of  these values: "" "one" "two" "one,two" A SET can have a maximum of 64 di erent members. Starting from 3.23.51 trailing spaces are automatically deleted from  SET  values when the table is created. MySQL  stores  SET  values  numerically,  with  the  low-order  bit  of  the  stored  value  corre- sponding to the rst set member.  If you retrieve a SET value in a numeric context, the value retrieved has bits set corresponding to the set members that make up the column value. For example, you can retrieve numeric values from a SET column like this: mysql> SELECT set_col+0 FROM tbl_name; If a number is stored into a SET column, the bits that are set in the binary representation of the number determine the set members in the column value.  Suppose a column is speci ed as SET("a","b","c","d").  Then the members have the following bit values: SET member Decimal value Binary value a 1 0001 b 2 0010 c 4 0100
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN REGISTRATION
    MANAGE YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    SITE MAP
    Home
    Hosting Plans | Domain Registration | About Us | Contact Us | Site Map
    Terms of Use | Privacy Policy | Guarantees
    Merchant Accounts

    SpiritHost - web hosting for spiritual and education sites
    SpiritHit.com - Religious and Spiritual Portal
  • Return to Table of Contents
  • Back to top

  • Web Hosting: Manuals & FAQ's

    1. Unix-Based Web Hosting
    2. Unix Dedicated Servers
    3. Windows Dedicated Servers
    4. CuteFTP User’s Guide
    5. CuteHTML User’s Guide
    6. WS_FTP Pro User's Guide
    7. Miva Order User's Guide
    8. Miva Merchant User's Guide