bostboy
January 7, 2015, 11:26pm
22
Thanks again for all the input. I certainly have enough to get me where I need to go until next time.
That’s correct for InnoDB, but is it correct for every DB out there?
I would suggest an excellent answer on StackExchange to the question “Should I use multiple column primary keys or add a new column? ”
felgall:
not normalised since you selected the wrong key2) allowed duplicates of data that shouldn’t be allowed to be duplicated.
You were presenting code for a corner case (as you call it) where there is no evidence that such a situation will exist. Stop trying to get so clever with your database design when talking to beginners and present them with the basic 3NF normalised version of the data they are working with instead of adding extra fields that break that normalisation. It is best that beginners learn how to properly normalise databases first and only break normalisation when they find genuine reasons to do so.
In the example you gave the licence plates are not unique when 6th normal form is taken into account when normalising the data and so the mistake was in not realising that 6NF applied to that data. A second field in the primary key would easily rectify that problem. Perfectly understandable that this error would be made since I don’t think 6NF existed nine years ago (or if it did many people working with databases will not have heard of it).
This is precisely why we are running out of mentors and people willing to try to help others out - they get dragged over the coals for a trivial mistake, usually by you. Screw it, I’m done with posting large examples.
Oh, come on. You have to accept criticism in order to get better. Otherwise what’s the point of showing your code? If you disagree that’s fine, but you have to support that with facts.
Now, this is getting way off topic. Therefore I’ll stop here.
Yes everyone , please do NOT engage in Off-topic discussion
Like if you like
Flag if you think doing so is appropriate
2 Likes
system
Closed
April 10, 2015, 1:03am
28
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.