MySQL Data Types
In a table, each
column has a type. As we mentioned earlier, an SQL data type is
similar to a data type in traditional programming languages. While
many languages define a bare-minimum set of types necessary for
completeness, SQL goes out of its way to provide types such as
DATE
that will be useful to everyday users. You
could store a DATE
type in a more basic numeric
type, but having a type specifically dedicated to the nuances of date
processing adds to SQL’s ease of use—one of
SQL’s primary goals.
Chapter 16 provides a full reference of SQL types supported by MySQL. Table 3-1 is an abbreviated listing of the most common types.
Data type |
Description |
|
An integer value. MySQL allows an |
|
A floating-point value. This type offers a greater range and more
precision than the |
|
A fixed-length character value. No |
|
A variable-length character value. |
|
A variable-length character value. |
|
A standard date value. The |
|
A standard time value. This type stores the time of day independent ... |
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.