Database Reference
In-Depth Information
If data retrieval is of utmost importance (as it usually is), you can instruct MariaDB to
lower the priority of your INSERT statement by adding the keyword LOW_PRIORITY in
between INSERT and INTO , like this:
INSERT LOW_PRIORITY INTO
Incidentally, this also applies to the UPDATE and DELETE statements that you learn
about in the next chapter.
Inserting Multiple Rows
INSERT inserts a single row into a table. But what if you need to insert mul-
tiple rows? You could simply use multiple INSERT statements, and could even
submit them all at once, each terminated by a semicolon, like this:
Input
INSERT INTO customers(cust_name,
cust_address,
cust_city,
cust_state,
cust_zip,
cust_country)
VALUES('Pep E. LaPew',
'100 Main Street',
'Los Angeles',
'CA',
'90046',
'USA');
INSERT INTO customers(cust_name,
cust_address,
cust_city,
cust_state,
cust_zip,
cust_country)
VALUES('M. Martian',
'42 Galaxy Way',
'New York',
'NY',
'11213',
'USA');
Or, as long as the column names (and order) are identical in each INSERT , you
could combine the statements as follows:
 
 
Search WWH ::




Custom Search