In DB2 Display a table's definition

后端 未结 11 1062
长情又很酷
长情又很酷 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 03:57

    DB2 Version 11.0

    Columns:
    --------
    SELECT NAME,COLTYPE,NULLS,LENGTH,SCALE,DEFAULT,DEFAULTVALUE FROM SYSIBM.SYSCOLUMNS where TBcreator ='ME' and TBNAME ='MY_TABLE' ORDER BY COLNO;
    
    Indexes:
    --------
    SELECT P.SPACE, K.IXNAME, I.UNIQUERULE, I.CLUSTERING, K.COLNAME, K.COLNO, K.ORDERING
    FROM SYSIBM.SYSINDEXES I
        JOIN SYSIBM.SYSINDEXPART P
            ON I.NAME = P.IXNAME
            AND I.CREATOR = P.IXCREATOR
        JOIN SYSIBM.SYSKEYS K
            ON P.IXNAME = K.IXNAME
            AND P.IXCREATOR = K.IXCREATOR
    WHERE I.TBcreator ='ME' and I.TBNAME ='MY_TABLE'
    ORDER BY K.IXNAME, K.COLSEQ;
    

提交回复
热议问题