Javatpoint Logo
Javatpoint Logo

PostgreSQL Show table

In this section, we are going to learn how we can show the tables in PostgreSQL. The list or show table is significant when we have many databases, which has several tables.

Sometimes the table names are the same in various databases; in that case, the show table command is very beneficial.

In PostgreSQL, we can show the tables with the help of two different ways as follows:

  • PostgreSQL show tables using psql
  • PostgreSQL show tables using pgadmin4

Note: In PostgreSQL, we cannot use the SHOW TABLES commands directly, as we can use in MySQL directly.

PostgreSQL show tables using psql

In psql, we can get the number of table information of a database with the help of the below command and to show tables in the current database:

To get the list of tables, we will follow the below steps:


  • Open the SQL shell (psql), which appeared with the necessary details. After that, we will log into the Postgres database server using the password which we have created during the installation process of PostgreSQL.
  • And we are connected to the Postgres server as we can see in the below screenshot:
PostgreSQL Show table


  • Now, we will connect to the specific database server which we created earlier that is javatpoint and with the help of below command:

PostgreSQL Show table


  • Finally, we will execute the SHOW TABLES command to see that the javatpoint database contains many tables.

Note: The \dt command is used to list all tables in the current database.


The following screenshot explains it more clearly:

PostgreSQL Show table

PostgreSQL show tables using pgAdmin4

In PostgreSQL, this is another way to show tables with the help of pgAdmin4.

In this, we are going to use the select command for requesting the data from the PostgreSQL catalog.

Note: To get all useful information about each table in the database, we will use the pg_tables.

SQL query in pgadmin4

We can see the above query in the SQL query tool:

PostgreSQL Show table

The table structures

The above query will generate the below table structure:

PostgreSQL Show table

Note: We can modify the condition in the WHERE clause to filter system tables.
We may get many tables if we ignore the WHERE clause, and that tables could be the system tables which are not useful for us.

Suppose, we will modify the schema name as myschema in the above query:

The SQL query in pgAdmin4

Once we change the query and click on the execute button, as we can see in the below image:

PostgreSQL Show table


We can see the table which we created in the myschema shown in the below image:

PostgreSQL Show table


we can use another query to show the tables in our database:

Note: Here, the information schema itself is a schema that is automatically present in all databases and called information_schema.

The SQL query in pgAdmin4

PostgreSQL Show table


Here, we can see the output of the above query:

PostgreSQL Show table

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA