SQL Rosetta Stone
aka how to translate commands between MySQL and PostgreSQL
Meta information
| MySQL | PostgreSQL |
|---|---|
| show databases; | \dn |
| show tables; | \dt |
| show columns from t1; | \d t1 |
| show indexes fom t1; | \di |
Time information
| MySQL | PostgreSQL |
|---|---|
| UNIX_TIMESTAMP() | SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2001-02-16 20:38:40-08'); |
| FROM_UNIXTIME() | select 1063147331.843::int4::abstime; |
| NOW() | NOW() |