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

    Chapter 6:  MySQL Language Reference 455 or   INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name [(col_name,...)] SELECT ... or   INSERT [LOW_PRIORITY | DELAYED] [IGNORE] [INTO] tbl_name SET col_name=(expression | DEFAULT), ... INSERT  inserts new rows into an existing table.  The  INSERT ... VALUES  form of the state- ment inserts rows based on explicitly speci ed values.  The INSERT ... SELECT form inserts rows  selected  from  another  table  or  tables.   The  INSERT ... VALUES  form  with  multiple value  lists  is  supported  in  MySQL  Version  3.22.5  or  later.    The  col_name=expression syntax is supported in MySQL Version 3.22.10 or later. tbl_name is the table into which rows should be inserted.  The column name list or the SET clause indicates which columns the statement speci es values for:    If you specify no column list for INSERT ... VALUES or INSERT ... SELECT, values for all columns must be provided in the VALUES() list or by the SELECT.  If you don't know the order of the columns in the table, use DESCRIBE tbl_name to nd out.    Any column not explicitly given a value is set to its default value.  For example, if you specify a column list that doesn't name all the columns in the table, unnamed columns are set to their default values.  Default value assignment is described in  Section 6.5.3 [CREATE TABLE], page 469. You can also use the keyword  DEFAULT  to set a column to its default value.  (New in MySQL 4.0.3.)  This makes it easier to write  INSERT  statements that assign values to all but a few columns, because it allows you to avoid writing an incomplete VALUES() list (a list that does not include a value for each column in the table).  Otherwise, you would have to write out the list of column names corresponding to each value in the VALUES()  list. MySQL always has a default value for all elds.  This is something that is imposed on MySQL to be able to work with both transactional and not transactional tables. Our view is that checking of elds content should be done in the application and not in the database server.    An  expression  may  refer  to  any  column  that  was  set  earlier  in  a  value  list.    For example, you can say this: mysql> INSERT INTO tbl_name (col1,col2) VALUES(15,col1*2); But not this: mysql> INSERT INTO tbl_name (col1,col2) VALUES(col2*2,15);    If you specify the keyword LOW_PRIORITY, execution of the INSERT is delayed until no other clients are reading from the table. In this case the client has to wait until the insert statement is completed, which may take a long time if the table is in heavy use.  This is in contrast to INSERT DELAYED, which lets the client continue at once.  See Section 6.4.4 [INSERT  DELAYED],  page  457.   Note  that  LOW_PRIORITY  should  normally  not  be used with MyISAM tables as this disables concurrent inserts.  See Section 7.1 [MyISAM], page 494.    If  you  specify  the  keyword  IGNORE  in  an  INSERT  with  many  value  rows,  any  rows that  duplicate  an  existing  PRIMARY  or  UNIQUE  key  in  the  table  are  ignored  and  are
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    MERCHANT ACCOUNTS
    DEDICATED SERVERS
    E-COMMERCE HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN
    REGISTRATION
    MANAGE
    YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    Corporate Info
    ABOUT US
    OUR NETWORK
    CONTACT US
    SITE MAP
    Copyright © 2002 Dyntex Group, Inc. All Rights Reserved
  • 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