PostgreSQL is a powerful, open source object-relational database system.
Basics Link to heading
- psql - the command-line interface for interacting with PostgreSQL
Command Link to heading
Connect to a specific DB Link to heading
psql -d db -U user
# e.g. psql -d mydb -U postgres
List databases Link to heading
\l
Select database Link to heading
\c db
# e.g. \c mydb
List tables Link to heading
\dt
List users Link to heading
\du
Get current version of PostgreSQL Link to heading
SELECT version();
Exit psql Link to heading
\q
# alter
exit