1DMF - I'm curious about when the material you cited was written.
Well the front cover shows
First published 2007, second edition 2009.
Copyright ª 2007, 2009 The Open University
I also know that 2014 is the last year you can take this course as it is being retired.
This is totally wrong, it's an advantage a pk has no other meaning than the key it is for the record. You're learning a wrong thing. Outdated.
I don't know how you came to this conclusion, though I can accept that some of the course may be dated, BCNF, set theory and data modelling concepts taught on this course have been around since the 70's (that's 18 & 19).
On an ERD you don't show FK's and only model the domain of discourse, surrogate keys have no meaning and therefore have no existence in the domain of discourse.
A primary key is selected from the candidate keys of the relation, the relation is made up of just the data being modelled in the domain of discourse.
I've not come across a single example in any of the OU courses covering normal form and functional dependencies where it state you should introduce a surrogate alternate key and make it the primary key?
Of course, data modelling and relational theory are separate to actual implementation and implementation is environment specific.
So is this type of implementation of creating surrogate alternate keys and setting them as the primary key MS SQL implementation specific?
They also state the following in Unit 2 page 12...
Note that the choice of primary key is determined by the meaning of the relation rather than the particular values of the data.
The accompanying information on the meaning of a relation is as follows...
The meaning of a relation can be defined by specifying when a given tuple belongs to the relation by means of a natural language predicate. This defines feasible tuples in terms of the value of the primary key and is best illustrated by an example, as below.
<a, b, c> is a tuple of Enrolment if and only if a student with a StudentId of ‘a’ enrolling on a course with code ‘b’ does so on date ‘c’.
How can an attribute that has no meaning in the relation be a primary key based on this specific concept?
The most famous example is take first name and last name as a natural key
Why? these cannot be natural keys, there are loads of people called John Smith, Joe Blogs etc.. This was all covered as part of the basics on this course. I can see from George's example that things such as N.I. numbers being an issue and I think the biggest problem is ensuring you have a valid one!
However typo's and invalid data doesn't form part of relational theory. It has to assume, if you provide a value for something, the data provided is accurate as long as it comes from the correct data set, of course, it is probable you would create a domain for these values and have data validation check constraints applied, which would help eliminate some errors, but of course not all.
However, data validation / integrity wasn't really dealt with on this course, if it looks like an N.I. number, is formatted as a valid N.I. number and is unique in the entity for the domain of discourse being modelled, how can you possibly know it is wrong?
But when you model your data, you have to ask questions like, "Will I always accurately know this piece of information", if the answer is 'no' then it cannot be a PK by the definition of what a PK is.
Not everyone knows what their N.I. number is, and as PK's can't be NULL... it's ruled out from being a PK.
But then again in relational theory, nothing is allowed to be NULL, the only time NULL plays a part is during implementation of posted foreign keys for optional participation in a relationship.
All things considered, I still prefer surrogate keys. As I stated earlier, the natural vs. surrogate topic is almost like politics and religion. Conversations to be avoided if possible.
as they say, never a truer word spoken in jest!
I cannot believe a reputable organisation such as the OU, give out computing degree qualifications for courses they have taught for years and it is all totally wrong?
Considering the extremely high scores I achieved through out the course , I can't believe I didn't understand what they were teaching, and it certainly isn't what is being suggested here?
I can see the need at times to introduce a surrogate PK if and only if no there are no obvious candidate keys to select from for the data being modelled. However, I can't see the need to arbitrarily introduce a surrogate alternate key on every single entity in the domain of discourse as common practice, based on the set theory and relational modelling I have been taught.
But seriously do I need to ask the OU for my money back for having just wasted 10 months of my time doing a course that teaches something that isn't correct or usable in the real world of computing?
I understood what they taught, so the only explanation can be what they taught was wrong, if that's the case!
"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."
"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music