Using INSERT DELAYED : 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 
Using INSERT DELAYED

/*
mysql> Drop table CDs;
Query OK, 0 rows affected (0.01 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.06 sec)

mysql> INSERT DELAYED INTO CDs
    -> SET CDName='Blues', Copyright=1998,
    ->    NumberDisks=DEFAULT, NumberInStock=4, NumberOnReserve=1,
    ->    NumberAvailable=NumberInStock-NumberOnReserve, CDType='Blues';
Query OK, 1 row affected (0.01 sec)

mysql> select * from CDs;
+------+--------+-----------+-------------+---------------+-----------------+-----------------+--------+---------------------+
| CDID | CDName | Copyright | NumberDisks | NumberInStock | NumberOnReserve | NumberAvailable | CDType | RowAdded            |
+------+--------+-----------+-------------+---------------+-----------------+-----------------+--------+---------------------+
|    1 | Blues  |      1998 |           1 |             4 |               1 |            3 | Blues  | 2005-10-09 09:19:47 |
+------+--------+-----------+-------------+---------------+-----------------+-----------------+--------+---------------------+
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 DELAYED INTO CDs
SET CDName='Blues', Copyright=1998,
   NumberDisks=DEFAULT, NumberInStock=4, NumberOnReserve=1,
   NumberAvailable=NumberInStock-NumberOnReserve, CDType='Blues';

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. Use INSERT LOW_PRIORITY command
6. Insert three rows together
w__ww__.___j___av__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.