Archive for June, 2007

SQL Rosetta Stone

Friday, June 29th, 2007

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()

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google]