×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

ER identifiy relationship question

ER identifiy relationship question

ER identifiy relationship question

(OP)
Hello,

I have a table.  Each row in the table can be defined by an automatically generated unique id number.  The individual rows can also be defined by a group of column elements (which happen to be foreign keys).

My primary key is the unique id number but it is also possible for cols 1,2, 3... to be grouped as a primary key.  Can I have both things labelled as primary keys at the same time or is this a bad practice? I ask because someone said that some of my relationships are identifying and that they should be labelled as such.

RE: ER identifiy relationship question

Quote:

Can I have both things labelled as primary keys at the same time
No.

Quote:

or is this a bad practice?
Yes.

The Primary Key is the field or combination of fields which serve to identify each row of the table. You don't want to be using two different expressions as identifiers in two different parts of your system and the database won't even let you try.

What you should do is define the unique ID as the Primary Key and then define the other columns as a composite Candidate Key. That way the database will prevent you entering a duplicate value in the unique ID or entering a duplicate combination in the other fields.

Geoff Franklin
http://www.alvechurchdata.co.uk

RE: ER identifiy relationship question

succinct, clear, and good advice

thanks for the valuable post, geoff

r937.com | rudy.ca

RE: ER identifiy relationship question

(OP)
ah...thanks.  Forgot abotu the old Candidate  key :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close