Understanding Primary Key/Composite Key [message #584737] |
Fri, 17 May 2013 06:45  |
Taha
Messages: 8 Registered: February 2009 Location: Karachi
|
Junior Member |
|
|
Hi,
I am following Lynda Tutorial for Normalization. I have understand normalization but still there are few basic question that i want to ask here.
The core concept of primary key is that it uniquely identifies each record in the table, but here in the given below image the 'COURSE' field is repeating 'SQL101' value again and again but still the teacher in the video is calling it primary key and combination of date & Course column Composite key.
My Question here is that how can a field which vales are repeating can be called as Primary Key? Please explain.

Thanks
Taha.
[Updated on: Fri, 17 May 2013 06:45] Report message to a moderator
|
|
|
|
Re: Understanding Primary Key/Composite Key [message #584741 is a reply to message #584738] |
Fri, 17 May 2013 06:52   |
Taha
Messages: 8 Registered: February 2009 Location: Karachi
|
Junior Member |
|
|
so if Primary Key is a Composite Key then we can repeat its value ?
e.g:- the combination of COURSE and DATE have to be unique and they can repeat themselves in their fields but their combination have to be unique?
|
|
|
Re: Understanding Primary Key/Composite Key [message #584742 is a reply to message #584738] |
Fri, 17 May 2013 06:53   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
If I had that in the database I would have two tables:
one with course and course title - pk course. The master list of courses
one with course, date, room, capacity etc - pk course and date - the list of when (and where) the courses are run.
|
|
|
Re: Understanding Primary Key/Composite Key [message #584743 is a reply to message #584741] |
Fri, 17 May 2013 06:54   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Taha wrote on Fri, 17 May 2013 12:52so if Primary Key is a Composite Key then we can repeat its value ?
e.g:- the combination of COURSE and DATE have to be unique and they can repeat themselves in their fields but their combination have to be unique?
yes
|
|
|
|
|
Re: Understanding Primary Key/Composite Key [message #584749 is a reply to message #584745] |
Fri, 17 May 2013 07:15   |
cookiemonster
Messages: 13967 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Taha wrote on Fri, 17 May 2013 12:59Thanks a lot for the help, 1 last question, Does Composite key can only be created in Foreign key Table? i.e i can not create Composite key in master table of Course.
With my example there is no point having a compostite key in the master table.
Other master tables may require one. It depends on the type of data you want to store, nothing more.
|
|
|
|
|
|
|
|