Home » SQL & PL/SQL » SQL & PL/SQL » composite, candidatekey
composite, candidatekey [message #9177] Fri, 24 October 2003 10:06 Go to next message
Priyanka Shah
Messages: 19
Registered: January 2003
Junior Member
Candidate key question
------------------------
How is the candidate key different from the primary key? (A candidate key is any field that could be used as a primary key it says in my book)

Composite key question
----------------------
A composite key is a unique key which is created by combining two or more fields. These fields are usually primary keys of other tables.

so student table has:
-----
s_id
s_name
s_address

Course table has
--------
course_id
course_name
--One student can take many courses
--One course can have many students

So being a many to many relationship we create another table enrollment.
This table has
--------
s_id
course_id
grade

So the composite key is combination of s_id and course_id My question is since this composite key is really used to create a unique primary key ..
What is the way to select this primary key? what does it look like?
Re: composite, candidatekey [message #9182 is a reply to message #9177] Fri, 24 October 2003 12:23 Go to previous message
Todd Barry
Messages: 4819
Registered: August 2001
Senior Member
See response/question in SQL forum. Please do not crosspost.
Previous Topic: Accessing Global Variable from Package Body.
Next Topic: oracle 9i candidate key
Goto Forum:
  


Current Time: Fri Apr 26 13:30:28 CDT 2024