gpt4 book ai didi

postgresql - 显示 postgresql 数据库架构

转载 作者:行者123 更新时间:2023-12-02 02:51:11 25 4
gpt4 key购买 nike

我想用 PostgreSQL 展示类似的东西,但我不知道我必须搜索什么

enter image description here

你能向我解释一下如何使用 PostgreSQL 显示类似的内容吗?

最佳答案

您共享的图像是表格的图形布局。 PostgreSQL 不会产生此类输出,但您可以通过运行 \d <tablename> 来获取各个表的布局。在 psql 中。这将为您提供列列表、列类型、约束、主键、外键和注释。

例如:

postgres=# \d catalogue
Table "public.catalogue"
Column | Type | Collation | Nullable | Default
-------------+---------+-----------+----------+---------------------------------------
id | integer | | not null | nextval('catalogue_id_seq'::regclass)
item | name | | |
qty | integer | | |
description | text | | |
Indexes:
"catalogue_pkey" PRIMARY KEY, btree (id)

或者,如果您需要基于 GUI 的解决方案,请查看 PgAdmin:https://www.pgadmin.org/

关于postgresql - 显示 postgresql 数据库架构,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61951222/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com