Tools Overview
postgres = open source relational database software
psql = command line tool to connect to postgres
pgAdmin = web based tool front end to psql - not discussing here
This cheat sheet is for psql. Other 3rd party tools exist for connecting to postgres databases. (Dbeaver is a popular choice)
Postgres cmd line tool psql
Official docs
https://www.postgresql.org/docs/current/app-psql.html
| Command | Description | 
|---|---|
| psql --help | list help | 
| psql --username=postgres | login to postgres cmd line | 
When logged in:
| Command | Description | 
|---|---|
| \list | print out list of databases | 
| \c <db name> | connect to a certain database | 
| \dt | show all tables in current schema | 
| \df | list functions of current database | 
| \dv | list views of current database | 
| \du | list users and roles | 
| \q | quit postgres cmd line | 
| SELECT * from mytable; | select statement to table | 

    
Top comments (0)