Skip to Content
MySQL Reference Manual
book

MySQL Reference Manual

by Michael Widenius, David Axmark, Kaj Arno
June 2002
Intermediate to advanced
816 pages
20h 46m
English
O'Reilly Media, Inc.
Content preview from MySQL Reference Manual

Column Types

MySQL supports a number of column types, which may be grouped into three categories: numeric types, date and time types, and string (character) types. This section first gives an overview of the types available and summarises the storage requirements for each column type, then provides a more detailed description of the properties of the types in each category. The overview is intentionally brief. The more detailed descriptions should be consulted for additional information about particular column types, such as the allowable formats in which you can specify values.

The column types supported by MySQL are listed next. The following code letters are used in the descriptions:

M

Indicates the maximum display size. The maximum legal display size is 255.

D

Applies to floating-point types and indicates the number of digits following the decimal point. The maximum possible value is 30, but should be no greater than M-2.

Square brackets ([ and ]) indicate parts of type specifiers that are optional.

Note that if you specify ZEROFILL for a column, MySQL will automatically add the UNSIGNED attribute to the column.

Warning: you should be aware that when you use subtraction between integer values where one is of type UNSIGNED, the result will be unsigned! See Section 6.3.5.

TINYINT[(M)] [UNSIGNED] [ZEROFILL]

A very small integer. The signed range is -128 to 127. The unsigned range is 0 to 255.

BIT , BOOL

These are synonyms for TINYINT(1).

SMALLINT[(M)] [UNSIGNED] [ZEROFILL]

A small ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

MySQL Troubleshooting

MySQL Troubleshooting

Sveta Smirnova
MySQL Cookbook

MySQL Cookbook

Paul DuBois
The MySQL Workshop

The MySQL Workshop

Thomas Pettit, Scott Cosentino, Dr. Vlad Sebastian Ionescu

Publisher Resources

ISBN: 0596002653Purchase bookErrata Page