かみぽわーる

kamipo's blog

MySQLユーザーのためのPostgreSQL対応表

毎回わからなくなってググってるから今度からここに追記していく。

MySQL PostgreSQL
show databases; \l
use dbname \c dbname
show tables; \dt
show table status from dbname; わからん
show create table [dbname.]tblname; わからん
show full columns from [dbname.]tblname; \d tblname もしくは↓で代替
SELECT * FROM information_schema.columns WHERE table_schema = 'dbname' AND table_name = 'tblname' ORDER BY ordinal_position; SELECT * FROM information_schema.columns WHERE table_catalog = 'dbname' AND table_name = 'tblname' ORDER BY ordinal_position;