PostgreSQL

Terminal Basics

PostgreSQL is available for download as ready-to-use packages or installers for various platforms, as well as a source code archive if you want to build it yourself. In addition PostgreSQL comes with a command line interface. Download PostgreSQL.

Starting the terminal

When starting the psql terminal you will be asked to enter the connection information (as shown below). The default values are specified within the brackets. If you want to use the default value just hit enter.

Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres: 

Common psql commands

Command Description
\? Helps with psql commands
\h Helps with sql commands
\l Lists all of your databases
\c [database] Connects to a database
\d Describes the connected database
\d [table] Describes a table
\i [file] Executes commands from a file
\q Quit