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

    148 MySQL Technical Reference for Version 4.0.3 If you enter this SELECT statement, then press Enter and wait for the result, nothing will happen.  Instead of wondering why this query takes so long, notice the clue provided by the "> prompt.  It tells you that mysql expects to see the rest of an unterminated string.  (Do you see the error in the statement?  The string "Smith is missing the second quote.) At this point, what do you do?  The simplest thing is to cancel the command.  However, you cannot just type \c in this case, because mysql interprets it as part of the string that it is collecting!  Instead, enter the closing quote character (so mysql knows you've nished the string), then type \c: mysql> SELECT * FROM my_table WHERE name = "Smith AND age < 30; "> "\c mysql> The prompt changes back to mysql>, indicating that mysql is ready for a new command. It's important to know what the '> and "> prompts signify, because if you mistakenly enter an  unterminated  string,  any  further  lines  you  type  will  appear  to  be  ignored  by  mysql- including a line containing QUIT!  This can be quite confusing, especially if you don't know that you need to supply the terminating quote before you can cancel the current command. 3.3  Creating and Using a Database Now that you know how to enter commands, it's time to access a database. Suppose you have several pets in your home (your menagerie) and you'd like to keep track of various types of information about them.  You can do so by creating tables to hold your data and loading them with the desired information.  Then you can answer di erent sorts of questions about your animals by retrieving data from the tables.  This section shows you how to:    Create a database    Create a table    Load data into the table    Retrieve data from the table in various ways    Use multiple tables The menagerie database will be simple (deliberately), but it is not dicult to think of real- world situations in which a similar type of database might be used. For example, a database like this could be used by a farmer to keep track of livestock, or by a veterinarian to keep track of patient records. A menagerie distribution containing some of the queries and sample data used in the following sections can be obtained from the MySQL web site.  It's available in either compressed tar format (http://www.mysql.com/Downloads/Contrib/Examples/menagerie or Zip format (http://www.mysql.com/Downloads/Contrib/Examples/menagerie.zip). Use the SHOW statement to nd out what databases currently exist on the server: mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql |
     

    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