Command Line UI
psql -U${user} -P${password} ${database} |
uses the command line ui to connect to database ${database} |
\? |
help |
\q |
quit |
MySQL to Postgres Command Reference
Show Commands
MySQL |
Postgres |
show databases; |
\l |
show schemas; |
\dn |
show tables; |
\dt |
show tables in schema; |
\dt prov_export_v6_08_mysql.* |
Search paths
/*change default schema*/use my_db;set search_path TO {schema1},{schema2},…
e.g. set search_path TO my_schema1,public
MySQL |
Postgres |
/*change database*/ use my_db; |
\c my_db; |
Dump metadata
describe providers;\d providers
MySQL |
Postgres |
describe table; |
\d table |
SQL differences
A big difference between Postgres and MySQL is in the handling of group by. MySQL does not adhere to the SQL standards and allows you to include columns in the query that aren’t in the group by list.