Show Databases, Tables and Columns in PostgreSQL

Man….why is it that every time I stop using PostgreSQL for more than a month I immediately forget how to list tables and columns?
Here’s a listing for posterity.

Show Databases

MySQL:

SHOW DATABASES;

PostgreSQL

\l

Show Tables

MySQL:

SHOW TABLES;

PostgreSQL

\d

Show Columns

MySQL:

SHOW COLUMNS;

PostgreSQL

\d+ tablename

Show Yourself Out (exit)

MySQL:

exit

PostgreSQL

\q

Leave a Reply

Your email address will not be published. Required fields are marked *