![]() | |
#41
| |||
| |||
|
|
If teachers are permitted to change their names, then names are not appropriate keys for teachers. Agreed; this was a skeleton table to demonstrate to the OP that tables can have redundant or even overlapping keys to preserve data integrity. Tony just gets easily side tracked and I am afraid I tend to fall for it myself. Sorry for the thread drift .. Instead of a teacher's name, we can tattoo a permanent bar code on the foreheads of the faculty, using their tax identification number ![]() |
#42
| |||
| |||
|
|
Agreed; this was a skeleton table to demonstrate to the OP that tables can have redundant or even overlapping keys to preserve data |
|
integrity. Tony just gets easily side tracked and I am afraid I tend to fall for it myself. Sorry for the thread drift .. |
#43
| |||
| |||
|
|
An example of a compound key. An enrollment system for courses, students, and enrollments. An enrollment might be called a student-course. In the MS design pattern, they will create keys for each table: StudentId for Students, CourseID for Courses, and StudentCourseID for StudentCourses. Lets accept for now that StudentID and CourseID are good ways to identify students and courses. Other participants will object, if the past is any guide, but you can analyze their objections for yourself. I claim, at this point, that StudentCourseID as a primary key for the third table, the StdentCourses table, is a bad idea. A better idea is to let StudentID and CourseID be a compound primary key for StudentCourses. These two columns will be in the database you get from the wizard anyway. They have to be there to serve as foreign keys, relating the row in StudentCourses to parent rows in Students and Courses. There is little to be lost, and much to be gained, by making these two column the compound primary key of this table. |
#44
| |||
| |||
|
|
THE SOFTWARE AND UNDERLYING TECHNOLOGY ARE NOT FAULT-TOLERANT AND ARE NOT DESIGNED, MANUFACTURED OR INTENDED FOR USE OR RESALE AS ON-LINE CONTROL EQUIPMENT IN HAZARDOUS ENVIRONMENTS REQUIRING FAIL-SAFE PERFORMANCE, SUCH AS IN THE OPERATION OF NUCLEAR FACILITIES, AIRCRAFT NAVIGATION OR COMMUNICATION SYSTEMS, AIR TRAFFIC CONTROL, DIRECT LIFE SUPPORT MACHINES, OR WEAPONS SYSTEMS, IN WHICH THE FAILURE OF THE SOFTWARE OR UNDERLYING TECHNOLOGY OR PRODUCT COULD LEAD DIRECTLY TO DEATH, PERSONAL INJURY, OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE ("HIGH RISK ACTIVITIES"). LICENSOR SPECIFICALLY DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY OF FITNESS FOR HIGH RISK ACTIVITIES .. . . not that our marketing and sales departments will mention it |
#45
| |||
| |||
|
|
If teachers are permitted to change their names, then names are not appropriate keys for teachers. Agreed; this was a skeleton table to demonstrate to the OP that tables can have redundant or even overlapping keys to preserve data integrity. Tony just gets easily side tracked and I am afraid I tend to fall for it myself. Sorry for the thread drift .. Instead of a teacher's name, we can tattoo a permanent bar code on the foreheads of the faculty, using their tax identification number ![]() |
#46
| |||
| |||
|
|
Celko what do you think of 1NF, 2NF, 3NF as programming exercises? |
|
but getting a dB into 3NF form if it's in 2NF or 1NF form is a bit of work, agreed? The U of Texas example was easy to follow but in the real world I doubt it's so cut and dry. |
|
Keep in mind I have a few days experience in this matter, but I think I'm on the right track with the above statement. |

#47
| |||
| |||
|
|
That does not allow for internationali[sz]ation. |

#48
| |||
| |||
|
|
BTW thinking of foreign keys as links is a common hard-to-get-rid-of misconception; Unlearn it, they really are different. Links point, foreign keys constrain. |
#49
| |||
| |||
|
|
On 14 Dec, 17:51, "Tony Rogerson" <tonyroger... (AT) torver (DOT) net> wrote: First of all, let's go back to your statement about just store the history - can you please show how you would do that with celko schema and still be able to reach the rows as per my examples? precisely: "The real world gets in the way" tells us nothing about why it would be a problem to update email address X to become email address Y. I just don't see what you are getting at. Here's another... create table blah ( emiladdress varchar(?) not null unique, who varchar(100) not null ) In the year 2006 I have an email address called tonyroger... (AT) sqlserver (DOT) eu.com everybody sends email to that address. insert blah values( 'tonyroger... (AT) sqlserver (DOT) eu.com' ) On 1st Jan 2007 I change the email address to tonyroger... (AT) torver (DOT) net I suddenly stop receiving emails because everybody is still emailing tonyroger... (AT) sqlserver (DOT) eu.com. update blah set emailaddress = 'tonyroger... (AT) torver (DOT) net' where emailaddress = 'tonyroger... (AT) sqlserver (DOT) eu.com' How do all the applications disconnected from the database now reach the record? They can't - the natural key has changed. You are saying that this is a distributed database but that it lacks a mechanism for accurately propagating changes out to all its nodes? Well in my view such a DBMS would be broken. It surely violates Codd's principle of "Distribution Independence". Let's follow your example to its conclusion though. The solution is to replace whatever copy of the Blah relation exists in the application with the new Blah relation that superceded it. Now all emails reach the correct address and there is no problem that requires a different key. |
|
-- David Portas |
#50
| |||
| |||
|
|
You are saying that this is a distributed database but that it lacks a mechanism for accurately propagating changes out to all its nodes? Well in my view such a DBMS would be broken. It surely violates Codd's principle of "Distribution Independence". Let's follow your example to its conclusion though. The solution is to replace whatever copy of the Blah relation exists in the application with the new Blah relation that superceded it. Now all emails reach the correct address and there is no problem that requires a different key. Forgive me for butting in, David, but where did you come up with the idea that it is a distributed database? What have disconnected applications--that is, applications that use something akin to disconnected ADO recordsets or ADO.NET datasets--to do with distributed databases? The question is: for how long is the data that was just read out of the database considered to be valid? Until the next update? Or is it stale as soon as its read? Does it have something to do with transaction control or locking? If several updates occur between the reading of one piece of information and the reading of another, how can you be sure that any answer that involves both pieces of information is correct? How can you be sure that you haven't read the same information twice? |
|
If you use an artificial key and a timestamp (or rowversion), then there can be no doubt as to whether or not the information in question changed between the first reading and the second. |
![]() |
| Thread Tools | |
| Display Modes | |
| |