Databases Reference
In-Depth Information
The options available in the Data section are:
INSERT DELAYED statements : Adds the DELAYED modifier to INSERT
statements. This accelerates the INSERT operation as it is queued to
the server, which will execute it when the table is not in use. This is a
MySQL non-standard extension, available only for MyISAM , MEMORY , and
ARCHIVE tables.
INSERT IGNORE statements : Normally, at import time, we cannot insert
duplicate values for unique keys, as this would abort the insert operation.
This option adds the IGNORE modifier to INSERT and UPDATE statements, thus
skipping the rows that generate duplicate key errors.
Function to use when dumping data : The choices are INSERT , UPDATE ,
and REPLACE . The most well-known of these types is the default INSERT
using INSERT statements to import back our data. At import time, however,
we could be in a situation where a table already exists and contains valuable
data, and we just want to update the columns that are in the current table we
are exporting. UPDATE generates statements, such as the following line of
code, updating a row when the same primary or unique key is found:
UPDATE `author` SET `id` = 1, `name` = 'John Smith', `phone` =
'111-1111' WHERE `id` = '1';
The third possibility, REPLACE , produces statements such as REPLACE INTO
`author` VALUES (1, 'John Smith', '111-1111'); These act similar to an
INSERT statement for new rows and update existing rows, based on primary
or unique keys.
Syntax to use when inserting data : There are several choices here. By
including column names in every statement, the resulting file is bigger, but
will prove more portable on various SQL systems with the added benefit of
being better documented. Inserting multiple rows with a statement is faster
than using multiple INSERT statements, but is less convenient as it makes
reading the resultant file harder. It also produces a smaller file, but each line
of this file is not executable in itself as each line does not have an INSERT
statement. If you cannot import the complete file in one operation, you
cannot split the file with a text editor and import it chunk by chunk.
Maximal length of created query : The single INSERT statement generated for
Extended inserts might become too big and could cause problems. Hence,
we set a limit to the number of characters for the length of this statement.
 
Search WWH ::




Custom Search