Home > Database > Mysql Tutorial > body text

How does MySQL store year values ​​in a table using YEAR data type?

PHPz
Release: 2023-08-28 17:21:02
forward
575 people have browsed it

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

MySQL allows declaring column YEAR type with the help of which we can store year value in the 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)
Copy after login

The above is the detailed content of How does MySQL store year values ​​in a table using YEAR data type?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!