/* 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(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 );
INSERT DELAYED INTO CDs SET CDName='Blues', Copyright=1998, NumberDisks=DEFAULT, NumberInStock=4, NumberOnReserve=1, NumberAvailable=NumberInStock-NumberOnReserve, CDType='Blues';
select * from CDs;
|