Skip to content

SQL Commands Cheat Sheet

SQL Commands Cheat Sheet

Data Query

Command Description
SELECT Query data from the database
WHERE Filter query results
JOIN Join data from multiple tables
GROUP BY Group the result set
ORDER BY Sort the result set
LIMIT Limit the number of query results

Table Management

Command Description
CREATE TABLE Create a new table
ALTER TABLE Modify the table structure
DROP TABLE Delete a table
INDEX Create and delete indexes

Data Manipulation

Command Description
INSERT Insert new data into the table
UPDATE Update data in the table
DELETE Delete data from the table

Transaction Processing

Command Description
BEGIN Start a transaction
COMMIT Commit a transaction
ROLLBACK Roll back a transaction

Others

Command Description
EXPLAIN Show the execution plan of a query
DESCRIBE Show the structure of a table
SHOW TABLES Show all tables
USE Select a database