Use INSERT LOW_PRIORITY command : Insert « Insert Delete Update « SQL / MySQL

SQL / MySQL
1. Backup Load
2. Command MySQL
3. Cursor
4. Data Type
5. Database
6. Date Time
7. Flow Control
8. Function
9. Insert Delete Update
10. Join
11. Key
12. Math
13. Procedure Function
14. Select Clause
15. String
16. Table Index
17. Transaction
18. Trigger
19. User Permission
20. View
21. Where Clause
Microsoft Office Word 2007 Tutorial
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
C# / CSharp Tutorial
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
SQL / MySQL » Insert Delete Update » Insert 
Use INSERT LOW_PRIORITY command

/*
mysql> Drop table CDs;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE CDs (
    ->    CDID SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
    ->    CDName VARCHAR(50) NOT NULL,
    ->    Copyright YEAR,
    ->    NumberDisks TINYINT UNSIGNED NOT NULL DEFAULT 1,
    ->    NumberInStock TINYINT UNSIGNED,
    ->    NumberOnReserve TINYINT UNSIGNED NOT NULL,
    ->    NumberAvailable TINYINT UNSIGNED NOT NULL,
    ->    CDType VARCHAR(20),
    ->    RowAdded TIMESTAMP
    -> );
Query OK, 0 rows affected (0.07 sec)

mysql> INSERT LOW_PRIORITY INTO CDs
    -> (CDName, Copyright, NumberDisks, NumberInStock, NumberOnReserve, NumberAvailable, CDType)
    -> VALUES
    -> ('Rain', 1995, DEFAULT, 13, 2, NumberInStock - NumberOnReserve, 'Classical');
Query OK, 1 row affected (0.00 sec)

mysql> select * from CDs;
+------+--------+-----------+-------------+---------------+-----------------+-----------------+-----------+---------------------+
| CDID | CDName | Copyright | NumberDisks | NumberInStock | NumberOnReserve | NumberAvailable | CDType    | RowAdded            |
+------+--------+-----------+-------------+---------------+-----------------+-----------------+-----------+---------------------+
|    1 | Rain   |      1995 |           1 |            13 |               2 |           11 | Classical | 2005-10-09 09:19:46 |
+------+--------+-----------+-------------+---------------+-----------------+-----------------+-----------+---------------------+
1 row in set (0.00 sec)
*/

Drop table CDs;


CREATE TABLE CDs (
   CDID SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
   CDName VARCHAR(50NOT NULL,
   Copyright YEAR,
   NumberDisks TINYINT UNSIGNED NOT NULL DEFAULT 1,
   NumberInStock TINYINT UNSIGNED,
   NumberOnReserve TINYINT UNSIGNED NOT NULL,
   NumberAvailable TINYINT UNSIGNED NOT NULL,
   CDType VARCHAR(20),
   RowAdded TIMESTAMP
);


INSERT LOW_PRIORITY INTO CDs 
(CDName, Copyright, NumberDisks, NumberInStock, NumberOnReserve, NumberAvailable, CDType)
VALUES 
('Rain', 1995, DEFAULT, 132, NumberInStock - NumberOnReserve, 'Classical');


select from CDs;
           
       
Related examples in the same category
1. Calculation in INSERT clause
2. Simple INSERT clause
3. Adding Multiple Rows to a Table
4. Calculation in INSERT command
5. Insert three rows together
6. Using INSERT DELAYED
w_w__w___._j___a___v_a__2___s_.co___m__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.