Saturday, October 23, 2021

Difference between SQL Primary Key and Candidate Key in Oracle

  • Primary Key:
    • A Primary Key is a column or a combination of columns that uniquely identify a record. Only one Candidate Key can be Primary Key.
  • Candidate Key: 
    • A Candidate Key can be any column or a combination of columns that can qualify as unique key in database. 
    • There can be multiple Candidate Keys in one table. 
    • Each Candidate Key can qualify as Primary Key.
One needs to be very careful in selecting the Primary Key as an incorrect selection can adversely impact the database architect and future normalization. For a Candidate Key to qualify as a Primary Key, it should be Non-NULL and Unique in any domain.

No comments:

Post a Comment

Query to get Parent and Child Accounts in Oracle APPS R12

SELECT ffv1.flex_value parent_account       ,ffvt1.description parent_account_desc   ,ffv2.flex_value child_account   ,ffvt2.description...