Postgre支持的命令转换:
-- 查询数据库信息 --> \l 或者\list
select t1.datname as 名称 ,t2.rolname as 拥有者 , pg_encoding_to_char(t1.encoding) as 字元编码 ,
datcollate as 校对规则,datctype as Ctype,datacl as 存取权限
from pg_database as t1 , pg_authid as t2
WHERE t1.datdba = t2.oid and t1.datistemplate = false;
-- 切换数据库 --> \c dbname
-- 查询表信息 --> \d
select schemaname as 架构模式,tablename as 名称 ,tableowner as 拥有者 from pg_tables where schemaname = 'public' order by tablename asc
-- 显示单个表的所有字段 \d tablename
select column_name as 栏位,data_type as 类别,column_default as 修饰词 from information_schema.Columns where table_name = 'cities'