- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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;
- Related Articles
- What is the definition of a key currency?
- How to find the primary key of a DB2 table TAB1?
- What is the purpose and usage of “WHERE CURRENT OF” clause in a COBOL-DB2 program?
- What is the purpose and usage of “FOR UPDATE OF” clause in a COBOL-DB2 program
- What is the purpose and usage of SQLCODE within the SQLCA in a COBOL-DB2 program
- What is Browser Isolation? (Definition, Types, and Usage)
- Example and usage of JOINS in DB2
- What is the usage and purpose of DCLGEN and host variables used in COBOL-DB2 program
- What Is a Project: Definition, Types, Key Features and More
- What is the significance of ACCESSTYPE and INDEXONLY column of a PLAN table in DB2?
- How to update DB2 table with a duplicate primary key?
- Purpose and usage of ROW-ID and SEQUENCE in a DB2
- What is NULL check and insertion rule in a DB2 table?
- Alternate Key in RDBMS
- Purpose and usage of SAVEPOINT in COBOL-DB2 program

Advertisements