What is the candidate key, and the primary key?

189 Views Asked by At

I have two tables:

tblTrip (primaryKey: tripNo)
tblPerson (primaryKey: personID)

the relation between these 2 tables is n:n

so there is a relational table: tblParticipateIn (tripNo, personID...)

1- what is the candidate key of the table?

2- what is the primary key of the table?

3

There are 3 best solutions below

4
On BEST ANSWER

The primary key in tblParticipateIn is: tripNO and personID Since both in combination have to be unique

The candidate key are both: tripNO and personID, they are both optional as a primary key.

Read this for more info:

http://blog.sqlauthority.com/2009/10/22/sql-server-difference-between-candidate-keys-and-primary-key-2/

1
On

ans1-tripNo,personID both are candidate key ans2-tripN

0
On

It's impossible to answer your question completely without knowing the columns you've left out--the ones represented by ...--and their dependencies.

In most cases, the pair of columns {tripNo, personID} is one candidate key; there might be more candidate keys. The pair of columns {tripNo, personID} is the most likely primary key.