Hanin
Hanin

Reputation: 33

What is the candidate key, and the primary key?

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?

Upvotes: 0

Views: 179

Answers (3)

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.

Upvotes: 1

vivek kumar singh
vivek kumar singh

Reputation: 133

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

Upvotes: 0

Revils
Revils

Reputation: 1508

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/

Upvotes: -2

Related Questions