- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the definition and usage of alternate key in a DB2 table?
The DB2 table contains a number of columns whose value will remain unique in the entire table. Among these multiple columns only one column is selected as the primary key and the remaining keys are known as candidate keys.
We can declare any candidate key as an alternate key. Which means that the value of this key cannot take duplicate value, however unlike primary key the primary index is not built on the alternate key.
We can define alternate key while defining any table using a UNIQUE keyword. For example, if we want to make TRANSACTION_ID as an alternate key then−
CREATE TABLE ORDERS (ORDER_ID CHAR(15) NOT NULL, ORDER_DATE DATE, ORDER_TOTAL DECIMAL(9,2), TRANSACTION_ID CHAR(15), PRIMARY KEY(ORDER_ID), UNIQUE(TRANSACTION_ID)) IN DB4ES01;
- What is the definition of a key currency?
- What is Browser Isolation? (Definition, Types, and Usage)
- What is the purpose and usage of SQLCODE within the SQLCA in a COBOL-DB2 program
- How to find the primary key of a DB2 table TAB1?
- Example and usage of JOINS in DB2
- What is the significance of ACCESSTYPE and INDEXONLY column of a PLAN table in DB2?
- What is the usage and purpose of DCLGEN and host variables used in COBOL-DB2 program
- What is NULL check and insertion rule in a DB2 table?
- What is the purpose and usage of “FOR UPDATE OF” clause in a COBOL-DB2 program
- What is the purpose and usage of “WHERE CURRENT OF” clause in a COBOL-DB2 program?
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- What is Definition, Formula & Example of Key Rate Duration?
- Alternate Key in RDBMS
- Usage and syntax of INNER and OUTER JOIN in DB2
- How to update DB2 table with a duplicate primary key?