Insert values into multiple rows.
mysql>
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.01 sec)
mysql>
mysql> INSERT INTO CDs (CDName, Copyright, NumberDisks, NumberInStock, NumberOnReserve, NumberAvailable, CDType) VALUES
-> ('Mule Variations', 1999, 1, 9, 0,NumberInStock-NumberOnReserve, 'Blues'),
-> ('The Bonnie Raitt Collection', 1990, 1, 14, 2,NumberInStock-NumberOnReserve, 'Popular'),
-> ('Short Sharp Shocked', 1988, 1, 6, 1,NumberInStock-NumberOnReserve, 'Folk-Rock');
Query OK, 3 rows affected (0.00 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql>
mysql>
mysql> drop table CDs;
Query OK, 0 rows affected (0.00 sec)
mysql>
Related examples in the same category