2
$\begingroup$

I am studying database functional dependency. It says if A can functionally determine all other attributes, it is considered to be a key.

What if 2 tuples are exactly the same, can we still say A is a key? To me A cannot determine an unique tuple.

$\endgroup$

2 Answers 2

3
$\begingroup$

Pragmatically, You are correct that when you declare something as a primary key, that it must correspond to one tuple. Databases will not allow you to store a tuple in a table if the primary key already exists for a tuple in the table.

Theoretically, If $R$ is a relation with the following set A of attributes $\{a_1, a_2,..., a_n\}$, then a primary key on the relation $R$ would be a subset $P \subset A$ such that for $F:P \rightarrow A$, we have $\forall x,y \in P $ $F(x)=F(y) \rightarrow x=y$. This basically just means that the primary key forms a one-to-one mapping from the domain of keys to the range of corresponding tuples.

If you have that two tuples are the same $A$ and $B$, then this implies that $A = B$,and we still have that $F(A)=F(B)$ so that there is no violation, in that sense.

$\endgroup$
1
$\begingroup$

"What if 2 tuples are exactly the same ?"

If you are using relational database model, all tuples (rows) are unique. No two tuples(rows) can be same in a relation (table).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.