14th September 2023: PostgreSQL 16 Released!
Supported Versions: Current (16) / 15 / 14 / 13 / 12 / 11
Development Versions: devel
Unsupported versions: 10 / 9.6 / 9.5 / 9.4 / 9.3 / 9.2 / 9.1 / 9.0 / 8.4 / 8.3 / 8.2 / 8.1 / 8.0 / 7.4 / 7.3 / 7.2 / 7.1
This documentation is for an unsupported version of PostgreSQL.
You may want to view the same page for the current version, or one of the other supported versions listed above instead.

I. SQL Commands

This is reference information for the SQL commands supported by Postgres.

Table of Contents
ABORT --  Aborts the current transaction
ALTER GROUP --  Add users to a group, remove users from a group
ALTER TABLE --  Modifies table properties
ALTER USER --  Modifies user account information
BEGIN --  Begins a transaction in chained mode
CHECKPOINT -- Force transaction log checkpoint
CLOSE --  Close a cursor
CLUSTER --  Gives storage clustering advice to the server
COMMENT --  Add comment to an object
COMMIT --  Commits the current transaction
COPY --  Copies data between files and tables
CREATE AGGREGATE --  Defines a new aggregate function
CREATE CONSTRAINT TRIGGER --  Create a trigger to support a constraint
CREATE DATABASE --  Creates a new database
CREATE FUNCTION --  Defines a new function
CREATE GROUP --  Creates a new group
CREATE INDEX --  Constructs a secondary index
CREATE LANGUAGE --  Defines a new language for functions
CREATE OPERATOR --  Defines a new user operator
CREATE RULE --  Defines a new rule
CREATE SEQUENCE --  Creates a new sequence number generator
CREATE TABLE --  Creates a new table
CREATE TABLE AS --  Creates a new table from the results of a SELECT
CREATE TRIGGER --  Creates a new trigger
CREATE TYPE --  Defines a new base data type
CREATE USER --  Creates a new database user
CREATE VIEW --  Constructs a virtual table
DECLARE --  Defines a cursor for table access
DELETE --  Removes rows from a table
DROP AGGREGATE --  Removes the definition of an aggregate function
DROP DATABASE --  Removes an existing database
DROP FUNCTION --  Removes a user-defined C function
DROP GROUP --  Removes a group
DROP INDEX --  Removes existing indexes from a database
DROP LANGUAGE --  Removes a user-defined procedural language
DROP OPERATOR --  Removes an operator from the database
DROP RULE --  Removes existing rules from the database
DROP SEQUENCE --  Removes existing sequences from a database
DROP TABLE --  Removes existing tables from a database
DROP TRIGGER --  Removes the definition of a trigger
DROP TYPE --  Removes user-defined types from the system catalogs
DROP USER --  Removes a user
DROP VIEW --  Removes existing views from a database
END --  Commits the current transaction
EXPLAIN --  Shows statement execution plan
FETCH --  Gets rows using a cursor
GRANT --  Grants access privilege to a user, a group or all users
INSERT --  Inserts new rows into a table
LISTEN --  Listen for a response on a notify condition
LOAD --  Dynamically loads an object file
LOCK --  Explicitly lock a table inside a transaction
MOVE --  Moves cursor position
NOTIFY --  Signals all frontends and backends listening on a notify condition
REINDEX --  Recover corrupted system indexes under stand-alone Postgres
RESET -- Restores run-time parameters to default values
REVOKE --  Revokes access privilege from a user, a group or all users.
ROLLBACK --  Aborts the current transaction
SELECT --  Retrieves rows from a table or view
SELECT INTO --  Creates a new table from the results of a SELECT
SET -- Set run-time parameters
SET CONSTRAINTS -- Set the constraint mode of the current SQL-transaction
SET TRANSACTION -- Set the characteristics of the current SQL-transaction
SHOW -- Shows run-time parameters
TRUNCATE --  Empty a table
UNLISTEN --  Stop listening for notification
UPDATE --  Replaces values of columns in a table
VACUUM --  Clean and analyze a Postgres database