欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

PostgreSQL 列所有表结构的查询语句

程序员文章站 2022-06-05 21:35:56
...

PostgreSQL 列所有表结构的查询语句 SELECT tablename FROM pg_tables WHERE tablename NOT LIKE

PostgreSQL 列所有表结构的查询语句

SELECT tablename FROM pg_tables
WHERE tablename NOT LIKE 'pg%'
AND tablename NOT LIKE 'sql_%'
ORDER BY tablename;

查询表t_appointment_apply表的字段信息
SELECT a.attnum,a.attname AS field,t.typname AS type,a.attlen AS length,a
.atttypmod AS lengthvar,a.attnotnull AS notnull from pg_class c,pg_attribute a,pg_type t where c.relname='t_appointment_apply' and a.attnum>0 and a.attrelid=c.oid and a.atttypid=t.oid

PostgreSQL 列所有表结构的查询语句