tailieunhanh - SQL PROGRAMMING STYLE- P33
SQL PROGRAMMING STYLE- P33: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). | Every Table Must Have a Key to Be a Table 57 When I get a passport I need a birth certificate and fingerprinting. There is a little less trust here. When I get a security clearance I also need to be investigated. There is a lot less trust. A key without a verification method has no data integrity and will lead to the accumulation of bad data. 6. Simplicity. A key should be as simple as possible but no simpler. People reports and other systems will use the keys. Long complex keys are more subject to error storing and transmitting them is not an issue anymore the way it was 40 or 50 years ago. One person s simple is another person s complex. For an example of a horribly complex code that is in common international usage look up the International Standard Bank Number IBAN . A country code at the start of the string determines how to parse the rest of the string and it can be up to 34 alphanumeric characters in length. Why Each country has its own account numbering systems currencies and laws and they seldom match. In effect the IBAN is a local banking code hidden inside an international standard see http iban and the European Committee for Banking Standards Web site for publications . More and more programmers who have absolutely no database training are being told to design a database. They are using GUIDs IDENTITY ROWID and other proprietary auto-numbering features in SQL products to imitate either a record number sequential file system mindset or OID OO mindset because they don t know anything else. This magical universal one-size-fits-all numbering is totally nonrelational depends on the physical state of the hardware at a particular time and is a poor attempt at mimicking a magnetic tape file system. Experienced database designers tend toward intelligent keys they find in industry-standard codes such as UPC VIN GTIN ISBN and so on. They know that they need to verify the data against the reality they are modeling. A trusted external .
đang nạp các trang xem trước