mariadbWhat type to use for a year in Mariadb?
The type to use for a year in Mariadb is YEAR(4)
. This type is used to store a year in 4 digits format, such as 2020.
Example code
CREATE TABLE mytable (
year_column YEAR(4)
);
Output example
Query OK, 0 rows affected (0.02 sec)
Code explanation
CREATE TABLE
: This is a SQL command used to create a new table.mytable
: This is the name of the table being created.year_column
: This is the name of the column being created.YEAR(4)
: This is the type of the column being created. It is used to store a year in 4 digits format.
Helpful links
More of Mariadb
- How to check version of Mariadb?
- How to use UUID in Mariadb?
- Mariadb fulltext search example
- How to install Mariadb on Arch linux?
- How to install Mariadb on Ubuntu?
- How to remove user from Mariadb?
- How to get current year in Mariadb?
- How to work with XML in Mariadb?
- How to use xtrabackup in Mariadb?
See more codes...