Prev: ROLLBACK on error
Next: Problem with Update Trigger
From: sloan on 21 May 2010 13:19 On the first question, I can answer with a reference from the book: Fundamentals of Database Systems =======Quoted Material=========== 3.7.2 Proper Naming of Schema Constructs When designing a database schema, the choice of names for entity types, attributes, relationship types, and (particularly) roles is not always straightforward. One should choose names that convey, as much as possible, the meanings attached to the different constructs in the schema. ~~ We choose to use singular names for entity types, rather than plural ones, because the entity type name applies to each individual entity belonging to that entity type. ~~ In our ER diagrams, we will use the convention that entity type and relationship type names are in uppercase letters, attribute names are capitalized, and role names are in lowercase letters. We have already used this convention in Figure 3.2. ------end quoted material--------------- ISBN 0-321-12226-7 http://www.aw-bc.com/info/elmasri_navathe/assets/downloads/ch3.pdf Page 457 =============================== I'll try to answer the rest as well: //The SSN is CHAR(9) by definition; why did you invite crappy data with > an improper declaration? // I guess because I am a stupid idiot.......... This one is a little tougher, but I'll try to respond: //all those needless UNIQUEIDENTIFIER columns// I guess because I am a stupid idiot.......... //> Why did you use BIT flags as if this was Assembly language in the > 1950's?// I guess because I am a stupid idiot.......... //> Why do you have no DRI?// I guess because I am a stupid idiot.......... ............................ Ok...so I was able to respond to 5 out of 5 answers to questions, 4 of them (the last four) with very concrete reasons. So...I'll work on the me-being-a-repeat-idiot portion on this end of things. I do appreciate your posts. I own 3 of your books. 2 bought new, 1 bought used. Yes, before you ask, I have read 2 of them completely, and most of 1 of them. Somehow, me owning 3 of your books will probably turn into another way that I am a stupid idiot (for not following everything I read there). But I'm working on it. I'm also working on my gut (weight). I'm working on my generosity to others. And now I'll be working on my being-an-idiot factor. I'm also working on the way I treat others, something along the lines of the Ethic of Reciprocity and my own shortcomings in that area. Again, all of these are just things I'm saying to myself..............since I've received a revelation via this thread that I continue to make idiotic choices, one example being ... putting a hyphen in the SSN of my mockup data, and even allowing something like a hypen to be allowed via a varchar(11) instead of a char(9). So I'll continue to work on me, and try to avoid that kind of mistake in the future. ............ Now for a new question. Why do we (including myself) keep posting to a soon-to-be-dead medium? http://groups.google.com/group/microsoft.public.vc.mfc/msg/fb6819496c91c863 //Quote from the post above// //To this end, Microsoft will begin to progressively shift available resources to the forums technology and discontinue support for newsgroups. // ========= ========= ========= ========= ========= Schindler: They fear us because we have the power to kill arbitrarily. A man commits a crime, he should know better. We have him killed and we feel pretty good about it. Or we kill him ourselves and we feel even better. That's not power, though, that's justice. That's different than power. Power is when we have every justification to kill - and we don't. Goeth: You think that's power. Schindler: That's what the emperors had. A man stole something, he's brought in before the emperor, he throws himself down on the ground, he begs for mercy, he knows he's going to die. And the emperor pardons him. This worthless man, he lets him go. Goeth: I think you are drunk. Schindler: That's power, Amon. That is power. [gestures toward Goeth as a merciful emperor] Amon the Good. Goeth: [he smiles and laughs] I pardon you. Schindler's List, 1993 "--CELKO--" <jcelko212(a)earthlink.net> wrote in message news:f1a700f5-53e0-407c-a6f2-bfc388d68214(a)m33g2000vbi.googlegroups.com... > Why did you use a singular name for sets with more than one member? > Have you looked at ISO-11179 or any book on RDBMS? > > The SSN is CHAR(9) by definition; why did you invite crappy data with > an improper declaration? > > Why did you use all those needless UNIQUEIDENTIFIER columns? Why do > you have no keys in these non-tables? I know they look a lot like > pointers from the 1970's pre-RDBMS products, but we don't think that > way now. > > Why did you use BIT flags as if this was Assembly language in the > 1950's? > > Why do you have no DRI? > > If you had a relational design, would it be more like this? > > CREATE TABLE Persons > (ssn CHAR(9) NOT NULL PRIMARY KEY); > > CREATE TABLE Email_Addressees > (ssn CHAR(9) NOT NULL > REFERENCES Persons (ssn) > ON UPDATE CASCADE > ON DELETE CASCADE, > email_priority INTEGER NOT NULL > CHECK (email_priority > 0), > PRIMARY KEY (ssn, email_priority), > email_address VARCHAR(128) NOT NULL > ); > > SQL programmers think in terms of sets and silly bit flags in a punch > card: > > CREATE VIEW Primary_Email_Addressees (ssn, email_address) > AS > SELECT E1.ssn, E1.email_address > FROM Email_Addresses AS E1 > WHERE email_priority > = (SELECT MIN (E2.email_priority) > FROM Email_Addresses AS E2 > WHERE S1.ssn = S2.ssn); > |