Show Menu

MySQL Cheat Sheet by DaveChild

A cheat sheet for the MySQL database.

MySQL Data Types

CHARString (0 - 255)
VARCHARString (0 - 255)
TINYTEXTString (0 - 255)
TEXTString (0 - 65535)
BLOBString (0 - 65535)
MEDIUMTEXTString (0 - 16777215)
MEDIUMBLOBString (0 - 16777215)
LONGTEXTString (0 - 429496­7295)
LONGBLOBString (0 - 429496­7295)
TINYINT xInteger (-128 to 127)
SMALLINT xInteger (-32768 to 32767)
MEDIUMINT xInteger (-8388608 to 8388607)
INT xInteger (-2147­483648 to 214748­3647)
BIGINT xInteger (-9223­372­036­854­775808 to 922337­203­685­477­5807)
FLOATDecimal (precise to 23 digits)
DOUBLEDecimal (24 to 53 digits)
DECIMAL"­DOU­BLE­" stored as string
DATEYYYY-MM-DD
DATETIMEYYYY-MM-DD HH:MM:SS
TIMESTAMPYYYYMM­DDH­HMMSS
TIMEHH:MM:SS
ENUMOne of preset options
SETSelection 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 Grouping Functions

AVGMAX
BIT_ANDSTD
BIT_ORSTDDEV
COUNTSUM
GROUP_­CONCATVARIANCE
MIN
 

MySQL Mathematical Functions

ABSCOS
SIGNSIN
MODTAN
FLOORACOS
CEILINGASIN
ROUNDATAN, ATAN2
DIVCOT
EXPRAND
LNLEAST
LOG, LOG2, LOG10GREATEST
POWDEGREES
POWERRADIANS
SQRTTRUNCATE
PI
 

MySQL Date and Time Functions

DAYOFWEEKDATE_SUB
WEEKDAYADDDATE
DAYOFMONTHSUBDATE
DAYOFYEAREXTRACT
MONTHTO_DAYS
DAYNAMEFROM_DAYS
MONTHNAMEDATE_F­ORMAT
QUARTERTIME_F­ORMAT
WEEKCURREN­T_DATE
YEARCURREN­T_TIME
YEARWEEKNOW
HOURSYSDATE
MINUTEUNIX_T­IME­STAMP
SECONDFROM_U­NIXTIME
PERIOD_ADDSEC_TO­_TIME
PERIOD­_DIFFTIME_T­O_SEC
DATE_ADD

MySQL Control Flow Functions

MySQL Miscellaneous Functions

BIT_COUNTDES_EN­CRYPT
DATABASEDES_DE­CRYPT
USERLAST_I­NSE­RT_ID
SYSTEM­_USERFORMAT
SESSIO­N_USERVERSION
CURREN­T_USERCONNEC­TION_ID
PASSWORDGET_LOCK
OLD_PA­SSWORDRELEAS­E_LOCK
ENCRYPTIS_FRE­E_LOCK
DECODEBENCHMARK
MD5INET_NTOA
SHA1INET_ATON
AES_EN­CRYPTFOUND_ROWS
AES_DE­CRYPTSTRCMP
 

Share This Cheat Sheet!

Favourited by 50 Members:

Lasantha chi-zach sgmanivannan DeeJRoth McCloud clazito Dexter Keksdose caroline.artz ThibaultGomarin CenturyMan1979 and 40 more ...

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.