PostgreSQL View the table structure

PostgreSQL View the table structure,第1张

概述command line testdb=> \dt List of relations Schema | Name | Type | Owner --------+-----------+-------+------- public | orderinfo | table | zwc(1 row)testdb=> testdb=> \d orderinf

command line

testdb=> \dt         List of relations Schema |   name    | Type  | Owner --------+-----------+-------+------- public | orderinfo | table | zwc(1 row)testdb=> testdb=> \d orderinfo                                    table "public.orderinfo"    Column    |     Type     |                            ModifIErs                             --------------+--------------+------------------------------------------------------------------ orderinfo_ID | integer      | not null default nextval('orderinfo_orderinfo_ID_seq'::regclass) customer_ID  | integer      | not null date_placed  | date         | not null date_shipped | date         |  shipPing     | numeric(7,2) | Indexes:    "orderinfo_pk" PRIMARY KEY,btree (orderinfo_ID)


sql

testdb=> SELECTtestdb-> A .attname AS fIEld,testdb-> T .typname AS TYPE,testdb-> A .attlen AS LENGTH,testdb-> A .attnotnull AS NOTNulLtestdb-> FROMtestdb-> pg_class C,testdb-> pg_attribute A,testdb-> pg_type Ttestdb-> WHEREtestdb-> C .relname = 'orderinfo'testdb-> AND A .attnum > 0testdb-> AND A .attrelID = C .oIDtestdb-> AND A .atttypID = T .oID;    fIEld     |  type   | length | notnull --------------+---------+--------+--------- orderinfo_ID | int4    |      4 | t customer_ID  | int4    |      4 | t date_placed  | date    |      4 | t date_shipped | date    |      4 | f shipPing     | numeric |     -1 | f(5 rows)
总结

以上是内存溢出为你收集整理的PostgreSQL View the table structure全部内容,希望文章能够帮你解决PostgreSQL View the table structure所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/sjk/1177909.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-02
下一篇 2022-06-02

发表评论

登录后才能评论

评论列表(0条)

保存