How MySQL use YEAR data type to store year value in a table?



MySQL permits to declare a column YEAR type, with the help of which we can store year values in that column.

mysql> Create table year1 (Year_Copyright YEAR);
Query OK, 0 rows affected (0.21 sec)

mysql> Insert into year1(Year_Copyright) values (2017);
Query OK, 1 row affected (0.08 sec)

mysql> Select * from year1;
+----------------+
| Year_Copyright |
+----------------+
|          2017  |
+----------------+
1 row in set (0.00 sec)

Advertisements