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

    154 MySQL Technical Reference for Version 4.0.3 String comparisons are normally case-insensitive, so you can specify the name as "bowser", "BOWSER", etc.  The query result will be the same. You can specify conditions on any column, not just name.  For example, if you want to know which animals were born after 1998, test the birth column: mysql> SELECT * FROM pet WHERE birth >= "1998-1-1"; +----------+-------+---------+------+------------+-------+ | name | owner | species | sex   | birth | death | +----------+-------+---------+------+------------+-------+ | Chirpy | Gwen   | bird | f | 1998-09-11 | NULL   | | Puffball | Diane | hamster | f | 1999-03-30 | NULL   | +----------+-------+---------+------+------------+-------+ You can combine conditions, for example, to locate female dogs: mysql> SELECT * FROM pet WHERE species = "dog" AND sex = "f"; +-------+--------+---------+------+------------+-------+ | name   | owner   | species | sex   | birth | death | +-------+--------+---------+------+------------+-------+ | Buffy | Harold | dog | f | 1989-05-13 | NULL   | +-------+--------+---------+------+------------+-------+ The preceding query uses the AND logical operator.  There is also an OR operator: mysql> SELECT * FROM pet WHERE species = "snake" OR species = "bird"; +----------+-------+---------+------+------------+-------+ | name | owner | species | sex   | birth | death | +----------+-------+---------+------+------------+-------+ | Chirpy | Gwen   | bird | f | 1998-09-11 | NULL   | | Whistler | Gwen   | bird | NULL | 1997-12-09 | NULL   | | Slim | Benny | snake | m | 1996-04-29 | NULL   | +----------+-------+---------+------+------------+-------+ AND and OR may be intermixed. If you do that, it's a good idea to use parentheses to indicate how conditions should be grouped: mysql> SELECT * FROM pet WHERE (species = "cat" AND sex = "m") -> OR (species = "dog" AND sex = "f"); +-------+--------+---------+------+------------+-------+ | name   | owner   | species | sex   | birth | death | +-------+--------+---------+------+------------+-------+ | Claws | Gwen | cat | m | 1994-03-17 | NULL   | | Buffy | Harold | dog | f | 1989-05-13 | NULL   | +-------+--------+---------+------+------------+-------+ 3.3.4.3  Selecting Particular Columns If you don't want to see entire rows from your table, just name the columns in which you're interested,  separated by commas.   For example,  if you want to know when your animals were born, select the name and birth columns: mysql> SELECT name, birth FROM pet; +----------+------------+
     

    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