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

    152 MySQL Technical Reference for Version 4.0.3 You could create a text le `pet.txt' containing one record per line, with values separated by  tabs,  and  given  in  the  order  in  which  the  columns  were  listed  in  the  CREATE TABLE statement.   For  missing  values  (such  as  unknown  sexes  or  death  dates  for  animals  that are  still  living),  you  can  use  NULL  values.   To  represent  these  in  your  text   le,  use  \N. For example, the record for Whistler the bird would look like this (where the whitespace between values is a single tab character): name owner species    sex  birth death Whistler  Gwen bird \N   1997-12- 09 \N To load the text le `pet.txt' into the pet table, use this command: mysql> LOAD DATA LOCAL INFILE "pet.txt" INTO TABLE pet; You can specify the column value separator and end of line marker explicitly in the LOAD DATA  statement if you wish, but the defaults are tab and linefeed.  These are sucient for the statement to read the le `pet.txt' properly. When you want to add new records one at a time, the  INSERT  statement is useful.  In its simplest form, you supply values for each column, in the order in which the columns were listed in the CREATE TABLE statement.  Suppose Diane gets a new hamster named Pu ball. You could add a new record using an INSERT statement like this: mysql> INSERT INTO pet -> VALUES ('Puffball','Diane','hamster','f','1999-03-30',NULL); Note that string and date values are speci ed as quoted strings here.  Also, with  INSERT, you can insert  NULL  directly to represent a missing value.  You do not use  \N  like you do with LOAD DATA. From this example, you should be able to see that there would be a lot more typing involved to load your records initially using several INSERT statements rather than a single LOAD DATA statement. 3.3.4  Retrieving Information from a Table The  SELECT  statement is used to pull information from a table.  The general form of the statement is: SELECT what_to_select FROM which_table WHERE conditions_to_satisfy what_to_select  indicates what you want to see.   This can be a list of columns,  or  *  to indicate \all columns."  which_table  indicates the table from which you want to retrieve data.    The  WHERE  clause  is  optional.    If  it's  present,  conditions_to_satisfy  speci es conditions that rows must satisfy to qualify for retrieval. 3.3.4.1  Selecting All Data The simplest form of SELECT retrieves everything from a table:
     

    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