PostgreSQL is one of the best database engines for an average web project and many who moves to psql from mysql (for example) often ask the following questions: what is the analog of “show tables” in postgres? or how can I get the list of databases in postgres like “show databases” in mysql? The answers are short:
mysql:
SHOW TABLESpostgresql:
\dpostgresql:
SELECT table_name FROM information_schema.tables WHERE table_schema = 'public';mysql:
SHOW DATABASESpostgresql:
\lpostgresql:
SELECT datname FROM pg_database;mysql:
SHOW COLUMNSpostgresql:
\d tablepostgresql:
SELECT column_name FROM information_schema.columns WHERE table_name ='table';