To show list of databases
mysql: SHOW DATABASES
postgresql: \l
postgresql: SELECT datname FROM pg_database;

To connect/use a particular database

mysql: use database_name;

Postgresql: \c database_name

 

To show list of tables in your database
mysql: SHOW TABLES
postgresql: \d
postgresql: SELECT table_name FROM information_schema.tables WHERE table_schema = ‘public’;

 

To show list of columns in a particular table / schema use :
mysql: SHOW COLUMNS
postgresql: \d table_name
postgresql: SELECT column_name FROM information_schema.columns WHERE table_name =’table‘;

 

Advertisements