<< 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 461 In 3.23 TRUNCATE TABLE is mapped to COMMIT ; DELETE FROM table_name. See Section 6.4.6 [DELETE], page 459. TRUNCATE TABLE  di ers from  DELETE FROM ...  in the following ways:    Truncate operations drop and re-create the table, which is much faster than deleting rows one by one.    Not transaction-safe; you will get an error if you have an active transaction or an active table lock.    Doesn't return the number of deleted rows.    As long as the table de nition le `table_name.frm' is valid, the table can be re-created this way, even if the data or index les have become corrupted. TRUNCATE  is an Oracle SQL extension. 6.4.8  REPLACE Syntax REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name [(col_name,...)] VALUES (expression,...),(...),... or   REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name [(col_name,...)] SELECT ... or   REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name SET col_name=expression, col_name=expression,... REPLACE  works exactly like  INSERT, except that if an old record in the table has the same value as a new record on a UNIQUE index or PRIMARY KEY, the old record is deleted before the new record is inserted.  See Section 6.4.3 [INSERT], page 454. In other words, you can't access the values of the old row from a REPLACE statement.  In some old MySQL versions it appeared that you could do this, but that was a bug that has been corrected. When you use a REPLACE command, mysql_affected_rows() will return 2 if the new row replaced  an  old  row.   This  is  because  one  row  was  inserted  and  then  the  duplicate  was deleted. This  fact  makes  it  easy  to  determine  whether  REPLACE  added  or  replaced  a  row:   check whether the a ected-rows value is 1 (added) or 2 (replaced). Note that unless you use a UNIQUE index or PRIMARY KEY, using a REPLACE command makes no sense, since it would just do an INSERT. 6.4.9  LOAD DATA INFILE Syntax LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt' [REPLACE | IGNORE] INTO TABLE tbl_name [FIELDS
     

    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