How to show tables in PostgreSQL? How to exit Postgres psql command line utility? How to describe a table in PostreSQL? Find all the answers in our PostreSQL cheat sheet
We gathered a list of handy PostgreSQL commands and queries when working with PostgreSQL databases. Please ping us @ForestAdmin if you’d like to add something to the cheat sheet!
Getting started with PostgreSQL
Login and enter PostgreSQL command line utility psql
List postgres databases
Connect to postgres database
Exit postgreSQL command line utility psql
Managing PostgreSQL
Check PostgreSQL version
Check if PostgreSQL is installed
Check if PostgreSQL is running
Restart PostgreSQL on Linux
Restart PostgreSQL on OSX
Restart PostgreSQL on Windows
Change PostgreSQL user password
Exit from psql
Interacting with databases in PostgreSQL
List postgres databases
Connect or switch to postgres database
Create new postgres database
Delete postgres database
Rename postgres database
Interacting with tables in PostgreSQL
List postgres tables
Describe postgres table
Create postgres table
Delete postgres table
Backup and restore PostgreSQL database
Backup postgres database
Restore postgres database
Managing roles and permissions in PostgreSQL
List postgres roles
Create postgres user
Delete postgres user
Change postgres user password
List all assigned roles postgres
Grant all permissions on postgres database
Grant connection permissions on postgres database
List permissions for specific role postgres
ProstgreSQL psql commands recap
\? | List all available psql commands |
\h COMMAND | Get help on specific command |
\l | List databases |
\c databaseName | Connect to database |
\dt | List tables |
\d tableName | Describe table |
\d+ tableName | Describe table with details |
\dn | List schemas |
\df | List functions |
\dv | List views |
\du | List users |
\dy | List events |
\di | List indexes |
\q | Exit |
Need to build admin panels or a GUI tool for PostgreSQL? Check out Forest Admin for PostgreSQL
