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 work with XML in Mariadb?
- How to use xtrabackup in Mariadb?
- How to check version of Mariadb?
- How to use UUID in Mariadb?
- How to change wait_timeout in Mariadb?
- How to use the WITH clause in Mariadb?
- Working with JSON in Mariadb
- How to list available engines in Mariadb?
- How to backup all databases in Mariadb?
See more codes...