List of PostgreSQL Commands

Learn about important PostgreSQL commands.

List of PostgreSQL Commands

Commands

Description

\l or \list

Lists all databases and their corresponding owners

\c or \connect

Connects to a specific database

\dn

Lists all schemas

\dt

Lists all tables in the current database

\df

Lists all available functions in the current database

\d <table_name>

Describes the table, including its columns and their data types

\dv

Lists all the views in the current database

\du or \dus

Lists all the roles or users in the current database

\dy

Lists all event triggers in the current database

\dx

Lists all the installed extensions

\copy

Copies the data between a file and a table

\i <file_name>

Executes commands from a file with the specified file name

\q

Quits the pgsql interface

Get hands-on with 1200+ tech skills courses.