Basic postgres specific CLI commands

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the databases category.

Last Updated: 2024-11-21

From the command line:

dropdb name
createdb name```

psql # enter console

Within its SQL console:

Get help

\?

List databases

\l

Use a specified database:

\c project_p_development

List all tables

\dt 

Describe table schema, including a table's foreign keys and indexes:

\d table_name