如何使用 MySQL 資料型別來儲存表格中的年份值?


MySQL 允許宣告列型別,藉助列型別,我們可以在該列中儲存年份值。

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)

更新時間: 2020-01-28

389 次瀏覽

啟動你的 職業

完成課程認證

開始
廣告
© . All rights reserved.