Quick reference

SQL Commands Cheat Sheet

A complete SQL command reference manual, including core operations such as data query, table management, and index optimization, to help you master essential SQL skills for database development.

· Published · Updated

Scope. Relational SQL overview. LIMIT is supported by PostgreSQL and MySQL; DESCRIBE, SHOW TABLES and USE below are MySQL-specific. Always check the database dialect rather than treating every command as portable SQL.

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 table structure
DROP TABLE Delete a table
CREATE INDEX / DROP INDEX Create and delete indexes

Data Manipulation

Command Description
INSERT Insert new data into a table
UPDATE Update data in a table
DELETE Delete data from a 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 table structure
SHOW TABLES Show all tables
USE Select a database

Official reference

Related topics