Home Logo
Show Full Menu
Hide Full Menu
 

Data Types

Created: 26/10/10 Views: 2184 myFave Image


In this tutorial we will learn some basic MySQL datatypes

String Data

Name Range Notes Example
CHAR 0 to 255 characters Fixed Hello, how are you?
VARCHAR 0 to 255 characters Variable Hello, how are you?
TEXT 0 to 65535 characters Fixed Hello, how are you?
MEDIUMTEXT 0 to 16777215 characters Fixed Hello, how are you?
LONGTEXT 0 to 4294967295 characters   Hello, how are you?

Numeric Data

Name Range Notes Example
TINYINT -128 to 127   100
SMALLINT -32768 to 32767   -30000
MEDIUMINT -8388608 to 8388607   991231
INT -2147483648 to 2147483647   -203412532
BIGINT -9223372036854775808 to 9223372036854775807   3442342345
DECIMAL   Allows to give a specific decimal format setting the length/values to 'wholeNumber,decimalPlaces' 99.02

Date/Time Data

Name Range Notes Example
DATE YYYY-MM-DD   2010-02-15
DATETIME YYYY-MM-DD HH:MM:SS   2010-02-15 13:50:23
TIMESTAMP YYYYMMDDHHMMSS   20100215135023
TIME HH:MM:SS   13:50:23

Boolean Data

Name Range Notes Example
ENUM 1 to 65,535 values Set options in length/values to in the following format 'opt1' , 'opt2' , 'opt3' opt2



next tutorial: Creating a Table

There are no comments