Create table: default int value
/*
mysql> Drop table Employee;
mysql> CREATE TABLE Employee
-> (
-> ID SMALLINT UNSIGNED NOT NULL,
-> YearBorn YEAR NOT NULL,
-> CityBorn VARCHAR(40) NOT NULL DEFAULT 'Unknown'
-> );
Query OK, 0 rows affected (0.11 sec)
mysql> Describe Employee;
+----------+----------------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+----------------------+------+-----+---------+-------+
| ID | smallint(5) unsigned | | | 0 | |
| YearBorn | year(4) | | | 0000 | |
| CityBorn | varchar(40) | | | Unknown | |
+----------+----------------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
*/
Drop table Shelf;
CREATE TABLE Shelf
(
ID SMALLINT UNSIGNED NOT NULL,
YearBorn YEAR NOT NULL,
NumBooks SMALLINT NOT NULL DEFAULT 1
);
Describe Shelf;
Related examples in the same category