Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

5.5. Numeric Types

The ISO SQL:2003 standard defines two numeric types. Each numeric type has a few different data types. The standard numeric types and their associated keywords are:

  • Exact numeric type:

    • NUMERIC(g,f)

    • DECIMAL(g,f) can be abbreviated as DEC

    • SMALLINT

    • INTEGER can be abbreviated as INT

    • BIGINT

    Table 5.2. Summary of MySQL Binary Data Types
    Data Type NameSQL Standard?Fixed/Variable LengthRangeSizeAttributes
    BINARYNoFixedLength of 0–255 bytesM bytesDEFAULTNOT NULLNULL
    VARBINARYNoVariableLength of 0–65,532 bytesL*x + 1 if L<255L*x + 2 if L>255DEFAULTNOT NULLNULL
    TINYBLOBNoVariableMax length of 255 bytesL + 1 bytes 1 byte stores lengthNOT NULLNULL
    BLOBNoVariableMax length of 65,535 bytes (64 Kb)L + 2 bytes 2 bytes store lengthNOT NULLNULL
    MEDIUMBLOBNoVariableMax length of 16,777,215 bytes (16 Mb)L + 3 bytes 3 bytes store lengthNOT NULLNULL
    LONGBLOBNoVariableMax length of 4,294,967,295 bytes (4 Gb)L + 4 bytes 2 bytes store lengthNOT NULLNULL


  • Approximate numeric type:

    • FLOAT(p)

    • REAL

    • DOUBLE PRECISION


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial