tailieunhanh - SQL PROGRAMMING STYLE- P32
SQL PROGRAMMING STYLE- P32:Im mot trying to teach you to program in SQL in this book. You might want to read that again. If that is what you wanted, there are better books. This ought to be the second book you buy, not the first. I assume that you already write SQL at some level and want to get better at it. If you want to learn SQL programming tricks, get a copy of my other book, SQL for Smarties (3rd edition, 2005). | 62 CHAPTER 3 DATA DECLARATION LANGUAGE Codd also wrote the following There are three difficulties in employing user-controlled keys as permanent surrogates for entities. 1. The actual values of user-controlled keys are determined by users and must therefore be subject to change by them . if two companies merge the two employee databases might be combined with the result that some or all of the serial numbers might be changed . 2. Two relations may have user-controlled keys defined on distinct domains . one of them uses Social Security while the other uses employee serial numbers and yet the entities denoted are the same. 3. It may be necessary to carry information about an entity either before it has been assigned a user-controlled key value or after it has ceased to have one . an applicant for a job and a retiree . These difficulties have the important consequence that an equi-join on common key values may not yield the same result as a join on common entities. A solution proposed in part 4 and more fully in 14 is to introduce entity domains which contain system-assigned surrogates. Database users may cause the system to generate or delete a surrogate but they have no control over its value nor is its value ever displayed to them. . . Codd 1979 . Exceptions If you are using the table as a staging area for data scrubbing or some other purpose than as a database then feel free to use any kind of proprietary feature you wish to get the data right. We did a lot of this in the early days of RDBMS. Today however you should consider using ETL and other software tools that did not exist even a few years ago. Do Not Split Attributes Rationale Attribute splitting consists of taking an attribute and modeling it in more than one place in the schema. This violates Domain-key Normal Form Do Not Split Attributes 63 DKNF and makes programming insanely difficult. There are several ways to do this discussed in the following sections. Split into Tables The
đang nạp các trang xem trước