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:
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:
Note: The \dt command is used to list all tables in the current database.
The following screenshot explains it more clearly:
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:
The table structures
The above query will generate the below table structure:
Note: We can modify the condition in the WHERE clause to filter system tables.