<< 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

    404 MySQL Technical Reference for Version 4.0.3 d 8 1000 If you assign a value of 9 to this column, that is 1001 in binary, so the rst and fourth SET value members "a" and "d" are selected and the resulting value is "a,d". For a value containing more than one  SET  element, it does not matter what order the ele- ments are listed in when you insert the value.  It also does not matter how many times a given element is listed in the value.  When the value is retrieved later, each element in the value will appear once, with elements listed according to the order in which they were speci- ed at table creation time.  For example, if a column is speci ed as SET("a","b","c","d"), then "a,d", "d,a", and "d,a,a,d,d" will all appear as "a,d" when retrieved. If you set a SET column to an unsupported value, the value will be ignored. SET  values are sorted numerically.  NULL  values sort before non-NULL SET  values. Normally, you perform a SELECT on a SET column using the LIKE operator or the FIND_IN_ SET()  function: mysql> SELECT * FROM tbl_name WHERE set_col LIKE '%value%'; mysql> SELECT * FROM tbl_name WHERE FIND_IN_SET('value',set_col)>0; But the following will also work: mysql> SELECT * FROM tbl_name WHERE set_col = 'val1,val2'; mysql> SELECT * FROM tbl_name WHERE set_col & 1; The rst of these statements looks for an exact match.   The second looks for values con- taining the rst set member. If you want to get all possible values for a SET column, you should use:  SHOW COLUMNS FROM table_name LIKE set_column_name  and parse the  SET  de nition in the second column. 6.2.4  Choosing the Right Type for a Column For  the  most  ecient  use  of  storage,  try  to  use  the  most  precise  type  in  all  cases.   For example, if an integer column will be used for values in the range between  1  and  99999, MEDIUMINT UNSIGNED  is the best type. Accurate representation of monetary values is a common problem.  In MySQL, you should use the  DECIMAL  type.   This is stored as a string, so no loss of accuracy should occur.   If accuracy is not too important, the DOUBLE type may also be good enough. For high precision, you can always convert to a xed-point type stored in a  BIGINT.  This allows  you  to  do  all  calculations  with  integers  and  convert  results  back  to   oating-point values only when necessary. 6.2.5  Using Column Types from Other Database Engines To make it easier to use code written for SQL implementations from other vendors, MySQL maps column types as shown in the following table.  These mappings make it easier to move table de nitions from other database engines to MySQL: Other vendor type MySQL type BINARY(NUM) CHAR(NUM) BINARY
     

    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