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

    456 MySQL Technical Reference for Version 4.0.3 not inserted.   If you do not specify  IGNORE,  the insert is aborted if there is any row that  duplicates  an  existing  key  value.   You  can  determine  with  the  C  API  function mysql_info() how many rows were inserted into the table.   If MySQL was con gured using the DONT_USE_DEFAULT_FIELDS option, INSERT state- ments generate an error unless you explicitly specify values for all columns that require a non-NULL value.  See Section 2.3.3 [configure options], page 83.   You can nd the value used for an AUTO_INCREMENT column with the mysql_insert_id function.  See Section 8.4.3.30 [mysql_insert_id()], page 580. If you use INSERT ... SELECT or an INSERT ... VALUES statement with multiple value lists, you can use the C API function  mysql_info()  to get information about the query.  The format of the information string is shown here: Records: 100 Duplicates: 0 Warnings: 0 Duplicates  indicates  the  number  of  rows  that  couldn't  be  inserted  because  they  would duplicate some existing unique index value.  Warnings indicates the number of attempts to insert column values that were problematic in some way.  Warnings can occur under any of the following conditions:   Inserting NULL into a column that has been declared NOT NULL.  The column is set to its default value.   Setting a numeric column to a value that lies outside the column's range.  The value is clipped to the appropriate endpoint of the range.   Setting a numeric column to a value such as '10.34 a'. The trailing garbage is stripped and the remaining numeric part is inserted. If the value doesn't make sense as a number at all, the column is set to 0.   Inserting a string into a CHARVARCHARTEXT, or BLOB column that exceeds the column's maximum length.  The value is truncated to the column's maximum length.   Inserting a value into a date or time column that is illegal for the column type.  The column is set to the appropriate zero value for the type. 6.4.3.1  INSERT ... SELECT Syntax INSERT [LOW_PRIORITY] [IGNORE] [INTO] tbl_name [(column list)] SELECT With INSERT ... SELECT statement you can quickly insert many rows into a table from one or many tables. INSERT INTO tblTemp2 (fldID) SELECT tblTemp1.fldOrder_ID FROM tblTemp1 tblTemp1.fldOrder_ID > 100; The following conditions hold for an INSERT ... SELECT statement: The  target  table  of  the  INSERT  statement  cannot  appear  in  the  FROM  clause  of  the SELECT part of the query because it's forbidden in ANSI SQL to SELECT from the same table into which you are inserting. (The problem is that the SELECT possibly would nd records that were inserted earlier during the same run.  When using subselect clauses, the situation could easily be very confusing!) AUTO_INCREMENT  columns work as usual.
     

    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