In DB2 Display a table's definition

后端 未结 11 1179
长情又很酷
长情又很酷 2021-02-04 03:35

Hello everybody I am learning DB2 and would like to know how to see a table\'s characteristics after I create one.

Similar to the EXPLAIN TABLE command in MySQL.

<
11条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 04:02

    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.

    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.

    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
    

提交回复
热议问题