MySQL Quick Reference

Statement Syntax
CREATE DATABASE CREATE DATABASE database_name
CREATE TABLE CREATE TABLE my_table_name
(my_column_name1 data_type,my_column_name2 data_type,...)
SELECT SELECT my_column_name1,my_column_name1,...FROM my_table_name
SELECT * SELECT * FROM my_table_name
SELECT DISTINCT SELECT DISTINCT my_column_name1,my_column_name2,...FROM my_table_name
TRUNCATE TABLE TRUNCATE TABLE my_table_name
UPDATE UPDATE my_table_name SET column1=value,column2=value,...
WHERE some_column=any_value
WHERE SELECT my_column_name1,my_column_name2,...
FROM my_table_name WHERE my_column_name operator value
CREATE INDEX CREATE INDEX index_name ON my_table_name (my_column_name)
    OR
CREATE UNIQUE INDEX index_name ON my_table_name (my_column_name)
CREATE VIEW CREATE VIEW view_name AS SELECT my_column_name
FROM my_table_name WHERE condition
DELETE DELETE FROM my_table_name WHERE my_column_name=any_value
    OR
DELETE FROM my_table_name
DROP DATABASE DROP DATABASE database_name
DROP INDEX DROP INDEX index_name ON my_table_name
DROP TABLE DROP TABLE my_table_name
IN SELECT * FROM my_table_name
WHERE my_column_name IN (value1,value2,..)
INSERT INTO INSERT INTO my_table_name (column1, column2,...)
VALUES (value1, value2,...)
INNER JOIN SELECT my_column_name1,my_column_name2,...
FROM tableName1 INNER JOIN tableName2
ON tableName1.my_column_name=tableName2.my_column_name
LEFT JOIN SELECT my_column_name1,my_column_name2,...
FROM tableName1 LEFT JOIN tableName2
ON tableName1.my_column_name=tableName2.my_column_name
RIGHT JOIN SELECT my_column_name1,my_column_name2,...
FROM tableName1 RIGHT JOIN tableName2
ON tableName1.my_column_name=tableName2.my_column_name
LIKE SELECT my_column_name1,my_column_name2,...
FROM my_table_name WHERE my_column_name LIKE pattern
ORDER BY SELECT my_column_name1,my_column_name2,...
FROM my_table_name ORDER BY my_column_name [ASC|DESC]
AS (alias) SELECT my_column_name AS column_alias
FROM my_table_name
ALTER TABLE ALTER TABLE my_table_name
ADD my_column_name datatype
BETWEEN SELECT my_column_name1,my_column_name2,...
FROM my_table_name WHERE my_column_name
BETWEEN value1 AND value2
BETWEEN SELECT my_column_name1,my_column_name2,...
FROM my_table_name WHERE my_column_name
BETWEEN value1 AND value2
REGEXP SELECT my_column_name1,my_column_name2 FROM my_table_name WHERE my_column_name REGEXP 'regexp'