MySQL 8.0 Reference Manual 11.1.1 Numeric Data Type Syntax ................................................................................. 2012 11.1.2 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT ......................................................................................................................... 2016 11.1.3 Fixed-Point Types (Exact Value) - DECIMAL, NUMERIC ...................................... 2017 11.1.4 Floating-Point Types (Approximate Value) - FLOAT, DOUBLE .............................. 2017 11.1.5 Bit-Value Type - BIT ........................................................................................... 2018 11.1.6 Numeric Type Attributes ..................................................................................... 2018 11.1.7 Out-of-Range and Overflow Handling .................................................................. 2019 11.2 Date and Time Data Types ........................................................................................... 2021 11.2.1 Date and Time Data Type Syntax ....................................................................... 2022 11.2.2 The DATE, DATETIME, and TIMESTAMP Types ................................................. 2024 11.2.3 The TIME Type .................................................................................................. 2027 11.2.4 The YEAR Type ................................................................................................. 2028 11.2.5 Automatic Initialization and Updating for TIMESTAMP and DATETIME .................. 2029 11.2.6 Fractional Seconds in Time Values ..................................................................... 2032 11.2.7 Conversion Between Date and Time Types ......................................................... 2033 11.2.8 2-Digit Years in Dates ........................................................................................ 2034 11.3 String Data Types ......................................................................................................... 2034 11.3.1 String Data Type Syntax ..................................................................................... 2035 11.3.2 The CHAR and VARCHAR Types ....................................................................... 2039 11.3.3 The BINARY and VARBINARY Types ................................................................. 2040 11.3.4 The BLOB and TEXT Types ............................................................................... 2041 11.3.5 The ENUM Type ................................................................................................ 2043 11.3.6 The SET Type ................................................................................................... 2046 11.4 Spatial Data Types ....................................................................................................... 2048 11.4.1 Spatial Data Types ............................................................................................. 2050 11.4.2 The OpenGIS Geometry Model ........................................................................... 2051 11.4.3 Supported Spatial Data Formats ......................................................................... 2057 11.4.4 Geometry Well-Formedness and Validity ............................................................. 2060 11.4.5 Spatial Reference System Support ...................................................................... 2061 11.4.6 Creating Spatial Columns ................................................................................... 2062 11.4.7 Populating Spatial Columns ................................................................................ 2062 11.4.8 Fetching Spatial Data ......................................................................................... 2063 11.4.9 Optimizing Spatial Analysis ................................................................................. 2064 11.4.10 Creating Spatial Indexes ................................................................................... 2064 11.4.11 Using Spatial Indexes ....................................................................................... 2065 11.5 The JSON Data Type ................................................................................................... 2067 11.6 Data Type Default Values ............................................................................................. 2084 11.7 Data Type Storage Requirements .................................................................................. 2087 11.8 Choosing the Right Type for a Column .......................................................................... 2091 11.9 Using Data Types from Other Database Engines ............................................................ 2091 12 Functions and Operators .......................................................................................................... 2093 12.1 Built-In Function and Operator Reference ....................................................................... 2095 12.2 Loadable Function Reference ........................................................................................ 2116 12.3 Type Conversion in Expression Evaluation ..................................................................... 2119 12.4 Operators ..................................................................................................................... 2122 12.4.1 Operator Precedence ......................................................................................... 2124 12.4.2 Comparison Functions and Operators ................................................................. 2125 12.4.3 Logical Operators ............................................................................................... 2131 12.4.4 Assignment Operators ........................................................................................ 2133 12.5 Flow Control Functions .................................................................................................. 2134 12.6 Numeric Functions and Operators .................................................................................. 2137 12.6.1 Arithmetic Operators ........................................................................................... 2138 12.6.2 Mathematical Functions ...................................................................................... 2140 xii