Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why must a primary key be minimal?

A primary key is an attribute or set of attributes that uniquely identifies a row in a table. But a primary key has not only to be unique, but also minimal. Why is that necessary?

like image 250
user421446 Avatar asked Dec 13 '25 07:12

user421446


1 Answers

The reason why it's important to identify minimal keys is to ensure that there is no redundancy in dependencies on those keys. Redundancy can cause anomalies and incorrect results.

Minimality is essentially a semantic matter rather than purely a structural feature so it isn't necessarily required by the database implementation. For instance SQL allows you to create a "PRIMARY KEY" on any superkey, which may not be an irreducible superkey.

Minimality has nothing to do with storage size because minimal means irreducible, it does not mean smallest.

like image 128
nvogel Avatar answered Dec 15 '25 13:12

nvogel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!