How to find list tables in a PostgreSQL schema

In this article, we will see how to find list tables in a PostgreSQL schema with examples.

We can find the list of tables in a PostgreSQL schema using meta-command or by using SQL statement by querying against table pg_tables.

Find list tables in a PostgreSQL schema using meta-command:

1. Switch to the database.

\c adventureworks

2. Get the list of schemas in this database by using below command.

\dn

3. Find the list of tables in sales schema.

\dt sales.*

4. To get tables from all schemas:

\dt *.*

How to find list tables in a PostgreSQL schema

Find list tables in a PostgreSQL schema using sql statements:

SELECT * FROM information_schema.tables WHERE table_schema = 'sales';

select * from pg_tables where schemaname='sales';