在 DB2 中显示一个表的定义 [英] In DB2 Display a table's definition
问题描述
大家好,我正在学习 DB2,想知道如何创建表后查看表的特征.
Hello everybody I am learning DB2 and would like to know how to see a table's characteristics after I create one.
类似于 MySQL 中的 EXPLAIN TABLE 命令.
Similar to the EXPLAIN TABLE command in MySQL.
谢谢.
推荐答案
除了DESCRIBE TABLE
,还可以使用下面的命令
In addition to DESCRIBE TABLE
, you can use the command below
DESCRIBE INDEXES FOR TABLE *tablename* SHOW DETAIL
获取有关表索引的信息.
to get information about the table's indexes.
可以从 db2look 实用程序获得有关 Db2 for Linux、UNIX 和 Windows 上表的最全面的详细信息,您可以从远程客户端或直接在 Db2 服务器上以本地用户身份运行该实用程序.该工具生成模拟表及其统计数据所需的 DDL 和其他信息.Db2 11.5 中 db2look 的文档是 这里.
The most comprehensive detail about a table on Db2 for Linux, UNIX, and Windows can be obtained from the db2look utility, which you can run from a remote client or directly on the Db2 server as a local user. The tool produces the DDL and other information necessary to mimic tables and their statistical data. The docs for db2look in Db2 11.5 are here.
以下 db2look
命令将连接到 SALESDB 数据库并获取重新创建 ORDERS 表所需的 DDL 语句
The following db2look
command will connect to the SALESDB database and obtain the DDL statements necessary to recreate the ORDERS table
db2look -d SALESDB -e -t ORDERS
这篇关于在 DB2 中显示一个表的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!