

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to find the primary key of a DB2 table TAB1?
We can find the primary key of any table using the SYSIBM.SYSCOLUMNS table. The SYSIBM.SYSCOLUMNS is a DB2 system table which contains one row for every column of each table. It also contains the data related to the views. Below SQL query can be fired in order to find the primary key of a particular table.
SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = 'TAB1’ AND KEYSEQ > 0 ORDER BY KEYSEQ ASC;
We will use our table name in the TBNAME column of SYSCOLUMNS table using the WHERE clause and KEYSEQ > 0 will return only primary keys.
- Related Questions & Answers
- How to update DB2 table with a duplicate primary key?
- How to find all the foreign keys of a DB2 table TAB1?
- How to delete a DB2 table TAB1?
- How to find out all the indexes for a DB2 table TAB1?
- How to get the list of all COBOL-DB2 programs using a DB2 table TAB1?
- How to add a row compression to a DB2 table TAB1?
- How to image copy the entire DB2 table TAB1 into a dataset?
- How to reset the primary key of a table in mysql?
- How to add a new column Address in the above DB2 table TAB1?
- How to get primary key of a table in MySQL?
- How can I define a column of a MySQL table PRIMARY KEY without using the PRIMARY KEY keyword?
- How to create an ALIAS TAB2 for DB2 table TAB1?
- How to do a full & incremental MERGECOPY for a DB2 table TAB1?
- How to make MySQL table primary key auto increment?
- ALTER TABLE to add a composite primary key in MySQL?
Advertisements