Datatype | Description | Example: |
INT | Numeric entry | id INT |
VARCHAR(n) | Text string of characters up to n with a maximim of 255 characters | myVarChar VARCHAR(20) |
CHAR(n) | Text string with specific number (n) of characters. | myChar CHAR(30) |
TEXT | Holds between 255 - 65535 characters | myText TEXT |
DATE | The date stored in the format YYYY-MM-DD | myDate DATE |
TIME | The time stored in the format HH:MM:SS | myTime TIME |
The syntax for defining a field and datatype is 'fieldname datatype'.
If string length in CHAR(n) Column is less than 'n' then the string is padded by spaces (spaces are removed when data is retrieved).
n for CHAR(n) is 255 Maximum.
10.16.Introduction | ||||
10.16.1. | The basic datatypes | |||
10.16.2. | Date Datatypes | |||
10.16.3. | Numeric Types Storage | |||
10.16.4. | Numeric Types | |||
10.16.5. | ZEROFILL,UNSIGNED,SERIAL,SERIAL DEFAULT VALUE | |||
10.16.6. | Using Data Types from Other Database Engines | |||
10.16.7. | Data type mapping occurs at table creation time, after which the original type specifications are discarded. | |||
10.16.8. | Storage Requirements for Numeric Types | |||
10.16.9. | Storage Requirements for Date and Time Types | |||
10.16.10. | The format of the zero value for each type. |