Well, I believe it is in 3NF even with ‘id’ present. Also the ‘order no’ and ‘product no’ are not seperate keys by themselves but are rather a combined composite key. The individual key fields, you mentioned, are not keys by themselves as they would be non unique.
I personally find it useful to retain the ‘id’ field as it is normally an auto increment field and allows me to select records from the table in order of data entry.
Not that I see what difference it makes where the signature comes from I think I haved changed the setting to remove it. Also Tapatalk doesn’t have signature files so your suggestion is unworkable for me.
Back to the topic: The ‘id’ field is used by professional projects like djangoproject.com and I think Ruby on Rails does also so I am not sure what “professionals” you are referring to.
Yes, thats what I understood. However I have no access to sitepoint signatures from Tapatalk. (I suspect they don’t even work from Tapatalk.) If this site wishes to welcome Tapatalk users then I would hope it would not make unreasonable requests and thereby alienate mobile users.
Most mature database engines should allow for resequencing of auto increment fields should it be required. However I agree date time fields are more useful in that context.
All keys should be unique, not just surrogate, otherwise its not unique and therefore not strictly a key either. Individual fields comprising a composite key may not be unique but then its only the composite that is a key, not the individual key components.
One argument in favour of ‘id’ fields over a date field is that the semantics are clearer for ‘id’. With a date field you have to specify what time zone it refers to. Is it server time? browser time? Its worse if their are multiple servers in multiple time zones. So I think I will revisit my last comment and say ‘id’ is better but only if its done right with the id’s kept in proper sequence. However I believe it is easier to do ‘id’ right than a date field.
[This is getting a bit off topic as none of this has to do with 3NF. Maybe better to discuss the relative advantages of ‘id’ fields vs date fields in another thread.]
I personally would keep well clear of using a data field as a PK. Say you were using a date field for a PK, and the server is located in say Australia. Something happens and you end up with your site migrated onto a server located in California. You’re going to get anomalies in the data as records added between the time of the sever move over 19 hours (time difference between California and Eastern Australia) will appear to be newer then the existing records.
So, r937, if I add a Surrogate Key like “id”, does having that along side the Composite Natural Key formed by “order_no” and “product_no” break 3NF or not?
Some people say “Yes”, others imply “No”.
And that was one of my big questions in my OP because I have adopted the approach of every Table having an AutoIncrement “id” as the PK, and then making fields like “order_no” + “product_no” a Composite Unique Key to ensure physical uniqueness while still getting the benefits of the Surrogate Key.
(I probably won’t stop that approach, but I just wanted to keep my honest and verify if what “I” thought was 3NF was indeed among Database Experts?!)
Hehe, anyone who doesn’t use TapaTalk is not likely to understand how it works, so it’s an innocent mistake that you can just ignore. Yes, TT focuses just on content and strips out most of the distracting content, such as sigs, ads and what not.
that gobbledygook may be fine for a university classroom, but otherwise it’s severely lacking, if i may say so, in practicality
at the risk of being accused as a self-professed expert, i’m going to answer debbie, since she asked me, and say that the answer is no, it does not break 3NF to have both a surrogate PK and a composite alternate unique key
Well, you can’t win them all. I was actually just trying to help. You’ll get far worse bites than that out in other forums. Freenode springs to mind.
I didnt realize I was going to end up in what feels like a presidential election race and people have their favourite candidates for all sorts of reasons and one cannot fathom why.
Also I assume r937 has areas in which he shines. I just happen to have a different opinion in this case.
Anyway time for me to unsubscribe from this thread.