MySQL如何使用YEAR数据类型在表中存储年值?

2023年12月6日10:55:36

MySQL允许声明YEAR类型的列,借助它我们可以将年份值存储在该列中。

mysql> Create table year1 (Year_Copyright YEAR);

mysql> Insert into year1(Year_Copyright) values (2017);

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

  • 更新时间:2023年12月6日10:55:36 ,共 279 字。