tailieunhanh - Joe Celko s SQL for Smarties - Advanced SQL Programming P20
Joe Celko s SQL for Smarties - Advanced SQL Programming P20. In the SQL database community, Joe Celko is a well-known columnist and purveyor of valuable insights. In Joe Celko's SQL for Smarties: Advanced SQL Programming, he picks up where basic SQL training and experience leaves many database professionals and offers tips, techniques, and explanations that help readers extend their capabilities to top-tier SQL programming. Although Celko denies that the book is about database theory, he nevertheless alludes to theory often to buttress his practical points. This title is not for novices, as the author points out. Instead, its intended audience. | 162 CHAPTER 4 TEMPORAL DATA TYPES IN SQL This is because A1248 was thought then erroneously to be of magnitude 12 and LDS3402 was thought then also erroneously to be a double star system of magnitude . Interestingly the WDS_April_1 can also be defined as a table instead of as a view. The reason is that no future modifications to the WDS table will alter the state of that table back in April and so any future query of WDS_April_1 whether a view or a table will return the same result independently of when that query is specified. The decision to make WDS_April_1 a view or a table is entirely one of query efficiency versus disk space. We emphasize that only past states can be so queried. Even though the trans_stop value is forever chosen to make the queries discussed below easier to write this must be interpreted as now. We cannot unequivocally state what the WDS table will record in the future all we know is what is recorded now in that table and the erroneous values that were previously recorded in that table. Sequenced and nonsequenced queries are also possible on transaction-time state tables. Consider the query When was it recorded that A1248 had a magnitude other than The first part when was it recorded indicates that we are concerned with transaction time and thus must use the WDS_TT table. It also implies that if a particular time is returned the specified relationship should hold during that time. This indicates a sequenced query. In this case the query is a simple selection and projection. SELECT mag_first trans_start trans_stop FROM WDS_TT WHERE discoverer A 1248 AND mag_first The query results in mag_ trans_ trans first start stop 1989-03-12 1992-11-15 1992-11-15 1994-05-18 This result indicates that for a little more than five years the magnitude of the first star in this double star system was recorded incorrectly in the database. O The Nature of Temporal Data Models 163 We can use all the tricks discussed previously to write
đang nạp các trang xem trước