NULL values in candidate keys

884 Views Asked by At

I'm wondering whether a attribute can have multiple NULL values and still be a candidate key. Let's say we have a table with 3 columns, airport_id, airport_name, IATA_code. Primary_key is a airport_id. IATA_code is not always provided for an airport but when it is, it uniquely identifies an airport. Can I therefore say that IATA_code is a candidate key (but can not be a primary key) and therefore there exist functional dependency between IATA_code --> airport_id ?

1

There are 1 best solutions below

0
Broccoli_Salad On

According to the definition of candidate key in relational database, you cannot say IATA_code is one of candidate keys.

Candidate key is the set of attributes by which it is possible to identify each row of the table. Therefore, if some attribute is nullable, it cannot be one of candidate keys.