Show Menu

MySQL Cheat Sheet by

A cheat sheet for the MySQL database.
php     development     mysql     lamp     database     server

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
One of preset options
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 Grouping Functions

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

MySQL Mathem­atical 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 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

MySQL Miscel­laneous 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

Download the MySQL Cheat Sheet

2 Pages
//media.cheatography.com/storage/thumb/davechild_mysql.750.jpg

PDF (recommended)

Alternative Downloads

Thank The Author!

You can use Flattr to thank the author of this cheat sheet!

Like this cheat sheet? Check out our sponsors!

Readability-Score.com is a collection of tools to make your writing better. More readabile content means higher conversion rates and better reader engagement. Measure website and document readability, measure keyword density and more!

Click Here To Get Started!

 

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.

          Related Cheat Sheets

          mod_rewrite Cheat Sheet
          PHP Cheat Sheet
          SQL Server Cheat Sheet

          More Cheat Sheets by DaveChild

          Regular Expressions Cheat Sheet
          Linux Command Line Cheat Sheet
          CSS2 Cheat Sheet