The Server Pages

»

TheServerPages Articles

»

Webmasters

»

Databases

»

MySQL

Quick MySQL Cheat Sheet/Quick Reference

Author: Wojjie     Posted: 2005-03-14     Viewed: 24,354

Introduction:

There are various little details that I always end up having to lookup on the MySQL documentation, so I thought I would put together a 'Cheat Sheet' and make it publicly available for all to use. This 'Cheat Sheet' will be updated constantly.



Numeric Types: (Found in: MySQL :: 11.2 Numeric Types)
TypeBytesMinimum ValueMaximum Value
TINYINT1-128127
TINYINT UNSIGNED10255
SMALLINT2-32,76832,767
SMALLINT UNSIGNED2065,535
MEDIUMINT3-8,388,6088,388,607
MEDIUMINT UNSIGNED3016,777,215
INT4-2,147,483,6482,147,483,647
INT UNSIGNED404,294,967,295
BIGINT8-9,223,372,036,854,775,8089,223,372,036,854,775,807
BIGINT UNSIGNED8018,446,744,073,709,551,615
TypeBytesPrecision 
FLOAT40-23 
DOUBLE824-53 


String Types: (Found in: MySQL :: 11.4 String Types)
TypeMax Size (Bytes)
CHAR255
VARCHAR255
BINARY255
VARBINARY255
TINYTEXT255
TEXT65,535
MEDIUMTEXT16,777,215
LONGTEXT4,294,967,295
TINYBLOB255
BLOB65,535
MEDIUMBLOB16,777,215
LONGBLOB4,294,967,295


Quick SQL Reference:

Transaction:
- MySQL :: 13.4.1 START TRANSACTION, COMMIT, and ROLLBACK Syntax
START TRANSACTION;
  .. sql ..
COMMIT;


Change of Table Engine:
- MySQL :: 14 MySQL Storage Engines and Table Types
- MySQL :: 13.2.6 CREATE TABLE Syntax
ALTER TABLE [table_name] engine=[engine_name];


Conditional Statements (IF):
- MySQL :: 12.2 Control Flow Functions
SELECT IF(1=2,'you should not be able to see this!','correct (false statement)');

Comments

Copyright © 2004-2015: TheServerPages.com