Select specific columns
Read only the columns needed from a table.
SELECT <columns> FROM <table>;Query, join, aggregate, update, and inspect relational data with clear dialect labels.
Read only the columns needed from a table.
SELECT <columns> FROM <table>;Return rows whose join key exists in both tables.
SELECT * FROM <left_table> AS l INNER JOIN <right_table> AS r ON l.<key> = r.<key>;Count how many rows belong to each distinct value.
SELECT <column>, COUNT(*) AS count FROM <table> GROUP BY <column>;Review the exact rows a later UPDATE statement would change.
SELECT * FROM <table> WHERE <condition>;Start a transaction so related changes can be committed or rolled back together.
BEGIN;Show how the database plans to execute a query without changing data.
EXPLAIN <query>;Search and copy controls need JavaScript. The command examples above remain readable without it.