![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
With a few hours of theory under my belt, I'd like to ask if there's ever a time that you don't want a completely normalized dB, that is, a normalized database being a dB that has no redundant information (my understanding of what a normalized database is). Or, is there ever a time that you want redundant keys (that is, the same keys in many different tables, that obviously are not linked (in a relationship) between two tables?). Having redundant attributes and/ or keys seems to me a very lazy way of designing a database that doesn't require lots of initial thought, but of course you have to pay for it by meticulously "synching" all redundant keys to one another everytime there is a change in one of the redundant keys, so the keys don't drift and have different values. But is there ever a time you want to do this? THanks in advance RL |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
"raylopez99" <raylopez99 (AT) yahoo (DOT) com> wrote in message news:15b312ea-1f66-4f22-abbb-63581e0eca73 (AT) x69g2000hsx (DOT) googlegroups.com... With a few hours of theory under my belt, I'd like to ask if there's ever a time that you don't want a completely normalized dB, that is, a normalized database being a dB that has no redundant information (my understanding of what a normalized database is). Or, is there ever a time that you want redundant keys (that is, the same keys in many different tables, that obviously are not linked (in a relationship) between two tables?). Having redundant attributes and/ or keys seems to me a very lazy way of designing a database that doesn't require lots of initial thought, but of course you have to pay for it by meticulously "synching" all redundant keys to one another everytime there is a change in one of the redundant keys, so the keys don't drift and have different values. But is there ever a time you want to do this? THanks in advance RL The answer is yes, there are times when a design is a good one, even if less than fully normalized. For each normalization form, there is a known set of anomalies that come up when you insert, update, or delete data in that form. If you are willing and able to program around those anomalies, and if the design yields benefits that justify that effort, it can be the right thing to do. Learning when to normalize is more subtle than learning how to normalize. There is a particular form of database design, called "star schema" that yields good results when used in a data mart or data warehouse situation. A star schema mimics a multidimensional database in relational (or SQL) form. A star schema follows design rules of its own, and those rules sometimes contradict the rules of normalization. The up side of star schema is that it's very easy to use with report generators, or with OLAP tools like Cognos or Business Objects. The down side of star schema is that the process of keeping the data current involves some fairly intricate programming, and heavy use of computer resources. Star schema, and other unnormalized or denormalized designs almost always cost more than they are worth when used in a high transaction operational setting, like OLTP. Unfortunately, most deviations from normalization occur due to blunders, and not due to well considered design decisions. Many deviations from normalization occur because the designer is unfamiliar with some of the normal forms. Back when I was building databases, I only really knew 1NF, 2NF, and 3NF. Update anomalies due to deviations from BCNF and beyond were rare, but my design process would not have obviated them. Another major cause of deviations from normalization is failure to understand the data. In particular, the functional dependendencies inherent in the data are not discovered during data analysis, and the design unknowingly violates normalization rules. By the time this is discovered, there is usually a large body of application code that is dependent of the bad design. Sometimes, denormalized design is the reult of sheer pigheadedness. |
#5
| |||
| |||
|
|
With a few hours of theory under my belt, I'd like to ask if there's ever a time that you don't want a completely normalized dB, that is, a normalized database being a dB that has no redundant information (my understanding of what a normalized database is). |
|
Or, is there ever a time that you want redundant keys (that is, the same keys in many different tables, that obviously are not linked (in a relationship) between two tables?). Having redundant attributes and/ or keys seems to me a very lazy way of designing a database that doesn't require lots of initial thought, but of course you have to pay for it by meticulously "synching" all redundant keys to one another everytime there is a change in one of the redundant keys, so the keys don't drift and have different values. |
|
But is there ever a time you want to do this? |
#6
| |||
| |||
|
|
CREATE TABLE Schedule (teacher VARCHAR(15) NOT NULL, class CHAR(15) NOT NULL, room INTEGER NOT NULL, period INTEGER NOT NULL, PRIMARY KEY (teacher, class, room, period)); That choice of a primary key is the most obvious one -- use all the columns. Typical rows would look like this: ('Mr. Celko', 'Database 101', 222, 6) |
#7
| |||
| |||
|
|
raylopez99 schreef: With a few hours of theory under my belt, I'd like to ask if there's ever a time that you don't want a completely normalized dB, that is, a normalized database being a dB that has no redundant information (my understanding of what a normalized database is). This question is very well put. First, about your understanding. The goal of normalizing is not to get rid of redundancies but to get rid of update anomalies. If, when in the real world your database is modeling one thing changes and you have to change several pieces of data in your database to keep it up to date, this means you have an update anomaly. Several (mostly increasingly strict) normal forms exist to check if your set of relations suffers from some anomaly with recepies of changes to it to make it comply. Just google for normal form if you didn't already. |
#8
| |||
| |||
|
|
CREATE TABLE Schedule (teacher VARCHAR(15) NOT NULL, class CHAR(15) NOT NULL, room INTEGER NOT NULL, period INTEGER NOT NULL, PRIMARY KEY (teacher, class, room, period)); That choice of a primary key is the most obvious one -- use all the columns. Typical rows would look like this: ('Mr. Celko', 'Database 101', 222, 6) And half way through term the teacher changed their name to 'Mrs Bunting' and now everybody is confused! Great example of why you should use an artificial key, I'll remember your example for a blog entry I'm writing. |
#9
| |||
| |||
|
|
I'll remember this. It is a great example of why no one should bother reading your blog. |
#10
| |||
| |||
|
|
On Dec 13, 2:10 pm, mAsterdam <mAster... (AT) vrijdag (DOT) org> wrote: raylopez99 schreef: With a few hours of theory under my belt, I'd like to ask if there's ever a time that you don't want a completely normalized dB, that is, a normalized database being a dB that has no redundant information (my understanding of what a normalized database is). This question is very well put. First, about your understanding. The goal of normalizing is not to get rid of redundancies but to get rid of update anomalies. If, when in the real world your database is modeling one thing changes and you have to change several pieces of data in your database to keep it up to date, this means you have an update anomaly. Several (mostly increasingly strict) normal forms exist to check if your set of relations suffers from some anomaly with recepies of changes to it to make it comply. Just google for normal form if you didn't already. Thanks; I did Google it,and learned a bit about 1NF, 2NF, 3NF here: http://defiant.yk.psu.edu/~lxn/IST_2...finitions.html While I didn't really understand the differences between the three types of NF (for one thing, it seems that they were dealing with a situation where the primary key was a 'compound key' that depended on several fields, and since I like to use GUIDs as the primary key almost exclusively, I don't really suffer from this problem*), it also seems that even with a fully normalized database (in 1,2 or 3NF), you will always have an UPDATE problem. The 'solution' is to minimize your hierarchy of UPDATES by employing a "star" configuration" or "cluster", as suggested or implied by David Cressey. This is where there is never more than two tables linked by the same key, which makes programming easlier (that is, you don't have to program the UPDATE anomalies recursively, but simply program the almost trivial parent-child UPDATE case). But, as a practical matter, sometimes it's hard to not have the same key propigate to a third table, so even as I type this I realize this advice is not practical. |
|
Anyway, thanks to everybody who replied, it seems that there's a lot to learn in dBs. |
|
RL * as a further practical consideration, one dB I use, personally more than anything else, is Access, which doesn't have compound keys to begin with |
![]() |
| Thread Tools | |
| Display Modes | |
| |