PostgreSQL: How to List Tables Using psql and pgAdmin
PostgreSQL: How to List Tables Using psql and pgAdmin When working with PostgreSQL databases, one of the most common tasks is viewing the list of tables available in a database. PostgreSQL provides multiple ways to list tables, including the psql command-line tool and the pgAdmin graphical interface . This guide explains both methods clearly with examples. List Tables Using psql Command Line The psql tool provides simple meta-commands to explore database objects. 1. Connect to Database psql -U username -d database_name 2. List All Tables \dt This command lists all tables in the current schema. 3. List Tables from a Specific Schema \dt public.* 4. List Tables with Pattern Matching \dt *order* This displays tables containing the word order in their name. List Tables Using SQL Query You can also list tables using SQL queries against system catalogs. SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' AND table_ty...