psql vs. mysql shell command cheatsheet
MySQL | Postgres | |
---|---|---|
list databases | SHOW DATABASES | \l |
change to a database | USE <db_name> | \c <db_name> |
list tables | SHOW TABLES | \dt |
describe a table | DESC <table_name> | \d <table_name> |
show the create table sql | SHOW CREATE TABLE <table_name> | pg_dump -st <table_name> <db_name> |
explain a query | EXPLAIN <sql_statement> | EXPLAIN <sql_statement> |
quit shell | QUIT | \q |