YEAR column type : YEAR « Data Types « MySQL Tutorial






mysql>
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)








10.26.YEAR
10.26.1.YEAR
10.26.2.YEAR column type
10.26.3.Insert value to a YEAR type column
10.26.4.Two-digit year
10.26.5.Four-digit year
10.26.6.To determine how many years served