15 Common and Useful PostgreSQL Commands

This tutorial, will give you a list of common and useful psql commands that helps you query data from PostgreSQL database server faster and more effective.
1) PostgreSQL Command: psql command to connect to a database
{Read:- 5 Ways to Improve SEO on Your WordPress Site }
postgres=# psql -d postgres -U postgres -W
postgres=# psql -h host -d database -U user -W
2) PostgreSQL Command: psql command to list databases
postgres=# \l
{Read:- How to Build a WordPress Site in 1 Day }
3) PostgreSQL Command: psql command to change database
postgres=# \c databasename
4) PostgreSQL Command: psql command to list tables
postgres=# \dt
{Read:- 10 WordPress Mistakes to Avoid }
5) PostgreSQL Command: psql command to describe table
postgres=# \d table_name
6) PostgreSQL Command: psql command to list of schema in current database
postgres=# \dn
7) PostgreSQL Command: psql command to list of functions in current database
{Read:- How to configure Horizontal Pod Autoscaler(HPA) in Kubernetes (EKS)? }
postgres=# \df
8) PostgreSQL Command: psql command to list of view in current database
postgres=# \dv
9) PostgreSQL Command: psql command to list all users and assign roles
postgres=# \du
10) PostgreSQL Command: psql command to check current PostgreSQL version
{Read:- WordPress VIP Features }
postgres=# SELECT version();
11) PostgreSQL Command: psql command to run previous command
postgres=# \g
12) PostgreSQL Command: psql command to view history of command
postgres=# \s
13) PostgreSQL Command: psql Help Command
postgres=# \?
14) PostgreSQL Command: psql command to on/off Timing
postgres=# \timing
15) PostgreSQL Command: Quit psql
postgres=# \q