查询表名

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

或者

select tablename from pg_tables where schemaname='public'

查询表结构

select
col.table_schema,
col.table_name,
col.ordinal_position,
col.column_name,
col.data_type,
col.character_maximum_length,
col.numeric_precision,
col.numeric_scale,
col.is_nullable,
col.column_default,
des.description
from
information_schema.columns col left join pg_description des on
col.table_name::regclass = des.objoid
and col.ordinal_position = des.objsubid
where
table_schema = 'public'
and table_name = 'table_name'
order by
ordinal_position;

Postgresql查询表和表结构的更多相关文章

  1. PostgreSQL查询表名称及表结构

    1. 查询表名称 在psql状态下查询表名称 \dt SQL方式查看表名称 SELECT viewname FROM pg_views WHERE schemaname ='public' Postg ...

  2. POSTGRESQL 创建表结构、修改字段、导入导出数据库(支持CSV)

    这两个月经常使用postgresql,总结一些经常使用的语句: --创建表 CREATE TABLE customers ( customerid SERIAL primary key , compa ...

  3. PostgreSQL查看表、表索引、视图、表结构

    -- 表索引select * from pg_indexes where tablename='person_wechat_label';select * from pg_statio_all_ind ...

  4. Sql语句导出数据库表结构及查询表视图储存过程名

    --一句Sql把表结构全部查询出来 SELECT 表名 = Case When A.colorder=1 Then D.name Else '' End, 表说明 = Case When A.colo ...

  5. PostgreSQL查看表、表索引、视图、表结构以及参数设置

    -- 表索引select * from pg_indexes where tablename='person_wechat_label';select * from pg_statio_all_ind ...

  6. SqlServer表结构查询

    一.前言 近两天项目升级数据迁移,将老版本(sqlserver)的数据迁移到新版本(mysql)数据库,需要整理一个Excel表格出来,映射两个库之间的表格字段,示例如下: Mysql数据库查询表结构 ...

  7. MySQL 查看表结构简单命令

    一.简单描述表结构,字段类型 desc tabl_name; 显示表结构,字段类型,主键,是否为空等属性,但不显示外键. 例如:desc table_name 二.查询表中列的注释信息 select ...

  8. 161215、MySQL 查看表结构简单命令

    一.简单描述表结构,字段类型desc tabl_name;显示表结构,字段类型,主键,是否为空等属性,但不显示外键.二.查询表中列的注释信息select * from information_sche ...

  9. MySQL 查看表结构简单命令。

    一.简单描述表结构,字段类型 desc tabl_name; 显示表结构,字段类型,主键,是否为空等属性,但不显示外键. 二.查询表中列的注释信息 select * from information_ ...

随机推荐

  1. docker dial unix /var/run/docker.sock: connect: permission denied

    Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker. ...

  2. xv6 trapframe定义的位置

    在x86.h的最下面,真是把我找吐了,MD

  3. Java输入输出挂

    import java.util.Comparator; import java.io.BufferedReader; import java.io.BufferedWriter; import ja ...

  4. Java-POJ1001-求高精度幂

    参考博客:https://www.cnblogs.com/downrainsun/p/11041960.html package poj.ProblemSet; import java.math.Bi ...

  5. Bugku-CTF之web8(txt????)

    Day29  

  6. js 实现文字转音频播放

    var msg = new SpeechSynthesisUtterance("hello World"); console.log(msg); window.speechSynt ...

  7. layui+ajax+select

    1.看效果 2.前端代码 <div class="layui-form-item"> <label class="layui-form-label&qu ...

  8. 忽视自身问题并“积极甩锅”,新氧CEO金星还要脸吗?

    编辑 | 于斌 出品 | 于见(mpyujian) "互联网医美第一股"新氧果然还是爆雷了. 说"果然"是因为于见曾经针对新氧目前的商业模式进行过分析,认为以新 ...

  9. P&R 5

    Floorplan: 要做好floorplan需要掌握哪些知识跟技能? 通常,遇到floorplan问题,大致的debug步骤跟方法有哪些? 如何衡量floorplan的QA? 芯片的整体架构模块划分 ...

  10. ehcache注解全面解析

    通过ehcache以编程方式使用缓存: 跟上面的方式相同,但是缓存通过ehcache去管理,当然比使用map有N多种好处,比如缓存太大了快达到上限之后,将哪一部分缓存清除出去.这种方式完全是通过代码的 ...