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

    400 MySQL Technical Reference for Version 4.0.3    As a two-digit string in the range  '00'  to  '99'.  Values in the ranges  '00'  to  '69' and '70' to '99' are converted to YEAR values in the ranges 2000 to 2069 and 1970 to 1999.    As a two-digit number in the range  1  to  99.  Values in the ranges  1  to  69  and  70  to 99  are converted to  YEAR  values in the ranges  2001  to  2069  and  1970  to  1999.  Note that the range for two-digit numbers is slightly di erent from the range for two-digit strings, because you cannot specify zero directly as a number and have it be interpreted as 2000.  You must specify it as a string '0' or '00' or it will be interpreted as 0000.    As the result of a function that returns a value that is acceptable in a  YEAR  context, such as NOW(). Illegal YEAR values are converted to 0000. 6.2.3  String Types The string types are CHARVARCHARBLOBTEXTENUM, and SET.  This section describes how these types work, their storage requirements, and how to use them in your queries. 6.2.3.1  The CHAR and VARCHAR Types The CHAR and VARCHAR types are similar, but di er in the way they are stored and retrieved. The length of a CHAR column is xed to the length that you declare when you create the table.  The length can be any value between 1 and 255.  (As of MySQL Version 3.23, the length of CHAR may be 0 to 255.)  When CHAR values are stored, they are right-padded with spaces to the speci ed length.  When CHAR values are retrieved, trailing spaces are removed. Values in VARCHAR columns are variable-length strings.  You can declare a VARCHAR column to be any length between 1 and 255, just as for CHAR columns.  However, in contrast to CHAR, VARCHAR  values are stored using only as many characters as are needed, plus one byte to record the length.  Values are not padded; instead, trailing spaces are removed when values are stored.  (This space removal di ers from the ANSI SQL speci cation.) If you assign a value to a  CHAR  or  VARCHAR  column that exceeds the column's maximum length, the value is truncated to t. The following table illustrates the di erences between the two types of columns by showing the result of storing various string values into CHAR(4) and VARCHAR(4) columns: Value CHAR(4) Storage required VARCHAR(4)   Storage required '' ' ' 4 bytes '' 1 byte 'ab' 'ab   ' 4 bytes 'ab' 3 bytes 'abcd' 'abcd' 4 bytes 'abcd' 5 bytes 'abcdefgh' 'abcd' 4 bytes 'abcd' 5 bytes The values retrieved from the CHAR(4) and VARCHAR(4) columns will be the same in each case, because trailing spaces are removed from CHAR columns upon retrieval. Values in CHAR and VARCHAR columns are sorted and compared in case-insensitive fashion, unless the BINARY attribute was speci ed when the table was created.  The BINARY attribute
     

    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