This is a draft cheat sheet. It is a work in progress and is not finished yet.
Operation
Create |
This operation is used to create a new database or table, and to add new records to a table. |
CREATE DATABASE database_name; CREATE TABLE table_name (column1 datatype, column2 datatype, ...); INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
|
READ |
This operation is used to retrieve data from a database. |
SELECT column_name FROM table_name WHERE condition;
SELECT * FROM table_name;
|
UPDATE |
This operation is used to modify existing records in a table. |
UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
|
DELETE |
This operation is used to remove records from a table, or to remove entire tables or databases. |
DELETE FROM table_name WHERE condition;
DROP TABLE table_name;
DROP DATABASE database_name;
|
|
code
CREATE DATABASE database_name;
CREATE TABLE table_name (column1 datatype, column2 datatype, ...);
INSERT INTO table_name (column1, column2, ...) VALUES (value1, value2, ...);
|
|
|
|