MySQL 如何使用 YEAR 資料型別儲存表中的年份值?
MySQL 允許使用 YEAR 型別來宣告一個欄位,藉助該欄位,我們可以儲存該欄位中的年份值。
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)
廣告