如何生成“创建表"postgreSQL 中现有表的 sql 语句 [英] How to generate the "create table" sql statement for an existing table in postgreSQL

查看:29
本文介绍了如何生成“创建表"postgreSQL 中现有表的 sql 语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 postgreSQL 中创建了一个表.想看建表的SQL语句,但是看不懂.

I have created a table in postgreSQL. I want to look at the SQL statement used to create the table but cannot figure it out.

如何通过命令行或 SQL 语句获取 Postgres 中现有表的 create table SQL 语句?

How do I get the create table SQL statement for an existing table in Postgres via commandline or SQL statement?

推荐答案

pg_dump -t 'schema-name.table-name' --schema-only database-name

更多信息 - 在手册中.

这篇关于如何生成“创建表"postgreSQL 中现有表的 sql 语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆