db2查看表結(jié)構(gòu)命令 db2如何查看一個(gè)表的索引由那些字段組成?
db2如何查看一個(gè)表的索引由那些字段組成?selecta.name,a.id_1,(selectscorefrombwhereid=a.id1)score1,a.id_2,(selectscorefr
db2如何查看一個(gè)表的索引由那些字段組成?
selecta.name,a.id_1,(selectscorefrombwhereid=a.id1)score1,a.id_2,(selectscorefrombwhereid=a.id2)score2fromaa
DB2如何通過系統(tǒng)表查詢表的唯一索引,哪張系統(tǒng)表?
可以通過系統(tǒng)表SYSCAT.INDEXES查詢索引,
下面是查詢表myschema.tbl上的唯一索引的語句:
select indschema, indname, colnames, uniquerule from syscat.indexes where tabschema="MYSCHEMA" and tabname="TBL1" and uniquerule in ("U", "P")
其中uniquerule 為"U"表示Unique,"P"表示用于實(shí)現(xiàn)Primary Key的索引