Database Reference
In-Depth Information
Table D.2
Numeric Datatypes
continued
Datatype
Description
SMALLINT
Integer value, supports numbers from
-32768
to
32767
(or
0
to
65535
if
UNSIGNED
)
TINYINT
Integer value, supports numbers from
-128
to
127
(or
0
to
255
if
UNSIGNED
)
Tip
Not Using Quotes Unlike strings, numeric values should never be enclosed within
quotes.
Tip
Storing Currency There is no special MariaDB datatype for currency values, use
DECIMAL(8,2)
instead.
MariaDB uses special datatypes for
the storage of date and time values as listed
in Table D.3.
Table D.3
Date and Time Datatypes
Datatype
Description
Date from
1000-01-01
to
9999-12-31
in the format
YYYY-MM-DD
.
DATE
DATETIME
A combination of
DATE
and
TIME
.
TIMESTAMP
Functionally equivalent to
DATETIME
(but with a smaller
range).
TIME
Time in the format
HH:MM:SS
.
YEAR
A 2- or 4-digit year, 2-digit years support a range of
70
(1970)
to
69
(2069); 4-digit years support a range of
1901
to
2155
.
Binary datatypes are used to store all sorts of data (even binary information),
such as graphic images, multimedia, and word processor documents (see
Table D.4).