How to know the primary key of a table without defining the
primary key in the table?

Answers were Sorted based on User's Feedback



How to know the primary key of a table without defining the primary key in the table?..

Answer / kums

you could use SYSIBM.SYSINDEXES table to know more about
the table index.

Is This Answer Correct ?    7 Yes 0 No

How to know the primary key of a table without defining the primary key in the table?..

Answer / nkv

Use the table name in SYSINDEXES to get the Primary index
name. The Primary index will have the value ā€˜Pā€™ against
UNIQUERULE column in this table. Use this index name in
SYSKEYS table to get the column(s) in Primary key.

Is This Answer Correct ?    1 Yes 0 No

How to know the primary key of a table without defining the primary key in the table?..

Answer / priya shankar

If a column of the table uniquely defines each row in the
table then that column is called the Primary Key. Please
correct me if I am wrong.

Is This Answer Correct ?    9 Yes 9 No

How to know the primary key of a table without defining the primary key in the table?..

Answer / mani

Execute:

SELECT TBCREATOR, TBNAME, NAME, KEYSEQ
FROM SYSIBM.SYSCOLUMNS
WHERE TBCREATOR = 'creater id'
AND TBNAME = 'table-name'
AND KEYSEQ > 0
ORDER BY KEYSEQ

a nonzero value for KEYSEQ indicates the place of a column in
the primary key.

Is This Answer Correct ?    2 Yes 2 No

How to know the primary key of a table without defining the primary key in the table?..

Answer / ambika

u can use sysibm.syskeys to view the primary key of a
particular table provided if u have declared any attribute
as NOT NULL. if there are multiple columns of such kind u
the above procedure wont help.

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More DB2 Interview Questions

my project is insurance management system,how to explain my work environment in interview?

2 Answers   CGI, Value Labs,


Bind concepts in DB2 cobol

10 Answers   IBM, TCS, TRD, Virtusa,


What is COPY PENDING status?

6 Answers  


How do I add a column to a table in db2?

0 Answers  


What is the difference between base table and view?

7 Answers  






Which one allows duplicate values Union or Union All ?

3 Answers  


what is different three logs in DB2?

1 Answers   Syntel,


How to find the maximum value in a column in the db2 database?

0 Answers  


What do you do to keep the cursor from closing after a commit?

1 Answers  


What types of tables are there in the db2 database?

0 Answers  


What is subquery ?

6 Answers  


What does db2 blu stand for?

0 Answers  


Categories