Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

YEAR column type

mysql> mysql> CREATE TABLE myTable     -> (     ->    ID SMALLINT UNSIGNED,     ->    Copyright YEAR,     ->    OrderDate TIMESTAMP     -> ); Query OK, 0 rows affected (0.05 sec) mysql> mysql> desc myTable; +-----------+----------------------+------+-----+-------------------+-------+ | Field     | Type                 | Null | Key | Default           | Extra | +-----------+----------------------+------+-----+-------------------+-------+ | ID        | smallint(5) unsigned | YES  |     | NULL              |       | | Copyright | year(4)              | YES  |     | NULL              |       | | OrderDate | timestamp            | NO   |     | CURRENT_TIMESTAMP |       | +-----------+----------------------+------+-----+-------------------+-------+ 3 rows in set (0.00 sec) mysql> mysql> drop table myTable; Query OK, 0 rows affected (0.00 sec)