MySQL Data Types

CHAR String (0 - 255)
VARCHAR String (0 - 255)
TINYTEXT String (0 - 255)
TEXT String (0 - 65535)
BLOB String (0 - 65535)
MEDIUMTEXT String (0 - 16777215)
MEDIUMBLOB String (0 - 16777215)
LONGTEXT String (0 - 429496­7295)
LONGBLOB String (0 - 429496­7295)
TINYINT x Integer (-128 to 127)
SMALLINT x Integer (-32768 to 32767)
MEDIUMINT x Integer (-8388608 to 8388607)
INT x Integer (-2147­483648 to 214748­3647)
BIGINT x Integer (-9223­372­036­854­775808 to 922337­203­685­477­5807)
FLOAT Decimal (precise to 23 digits)
DOUBLE Decimal (24 to 53 digits)
DECIMAL "­DOU­BLE­" stored as string
DATE YYYY-MM-DD
DATETIME YYYY-MM-DD HH:MM:SS
TIMESTAMP YYYYMM­DDH­HMMSS
TIME HH:MM:SS
ENUM One of preset options
SET Selection of preset options

Integers (marked x) that are "­UNS­IGN­ED" have the same range of values but start from 0 (i.e., an UNSIGNED TINYINT can have any value from 0 to 255).

MySQL Type Conversion

BINARY 'string'
CAST (expre­ssion AS datatype)
CONVERT (expre­ssion, datatype)

MySQL Grouping Functions

AVG MAX
BIT_AND STD
BIT_OR STDDEV
COUNT SUM
GROUP_­CONCAT VARIANCE
MIN
 

MySQL Mathematical Functions

ABS COS
SIGN SIN
MOD TAN
FLOOR ACOS
CEILING ASIN
ROUND ATAN, ATAN2
DIV COT
EXP RAND
LN LEAST
LOG, LOG2, LOG10 GREATEST
POW DEGREES
POWER RADIANS
SQRT TRUNCATE
PI

MySQL String Functions

ASCII MID
ORD SUBSTR­ING­_INDEX
CONV LTRIM
BIN,OC­T,HEX RTRIM
CHAR TRIM
CONCAT SOUNDEX
CONCAT_WS SPACE
LENGTH REPLACE
CHAR_L­ENGTH REPEAT
BIT_LENGTH REVERSE
LOCATE INSERT
INSTR ELT
LPAD FIELD
RPAD LCASE
LEFT UCASE
RIGHT LOAD_FILE
SUBSTRING QUOTE
 

MySQL Date and Time Functions

DAYOFWEEK DATE_SUB
WEEKDAY ADDDATE
DAYOFMONTH SUBDATE
DAYOFYEAR EXTRACT
MONTH TO_DAYS
DAYNAME FROM_DAYS
MONTHNAME DATE_F­ORMAT
QUARTER TIME_F­ORMAT
WEEK CURREN­T_DATE
YEAR CURREN­T_TIME
YEARWEEK NOW
HOUR SYSDATE
MINUTE UNIX_T­IME­STAMP
SECOND FROM_U­NIXTIME
PERIOD_ADD SEC_TO­_TIME
PERIOD­_DIFF TIME_T­O_SEC
DATE_ADD

MySQL Control Flow Functions

IF NULLIF
IFNULL

MySQL Miscellaneous Functions

BIT_COUNT DES_EN­CRYPT
DATABASE DES_DE­CRYPT
USER LAST_I­NSE­RT_ID
SYSTEM­_USER FORMAT
SESSIO­N_USER VERSION
CURREN­T_USER CONNEC­TION_ID
PASSWORD GET_LOCK
OLD_PA­SSWORD RELEAS­E_LOCK
ENCRYPT IS_FRE­E_LOCK
DECODE BENCHMARK
MD5 INET_NTOA
SHA1 INET_ATON
AES_EN­CRYPT FOUND_ROWS
AES_DE­CRYPT STRCMP
 

Share This Cheat Sheet!

Favourited by 47 Members:

jdmyers Barry1 michaelfox nschurdell blacklisted chipchops chris5marsh DaveChild CyberTron SamCollett cjvalotta arnoldobr anomalophobe brentscheidt GaBBBBB jagrock naesk Wbbourne miguelfrias Rober1992 maintainweb sebbu fedesilva carsol guslong fire9 rd5coding Vovovchka pneumatix andshecodes2 manjuv.gmit MrOggy85 Epoc akipta chi_zach Dranzz Coldblackice Dxerty Swahilikid Theosis gmickd CenturyMan1979 ThibaultGomarin caroline.artz Keksdose Dexter clazito

Comments

nels nels, 12:49 22 Nov 12

Thank You very much..

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.