Đang chuẩn bị liên kết để tải về tài liệu:
Joe Celko s SQL for Smarties - Advanced SQL Programming P39
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Joe Celko s SQL for Smarties - Advanced SQL Programming P39. 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. | 352 CHAPTER 17 THE SELECT STATEMENT implemented in actual products yet and nobody seems to be missing the OUTER UNION or CORRESPONDING clause. The inner join operator did get to be popular. This was fairly easy to implement since vendors only had to extend the parser without having to add more functionality. Additionally it is a binary operator and programmers are used to binary operators add subtract multiply and divide are all binary operators. E-R diagrams use lines between tables to show a relational schema. But this leads to a linear approach to problem solving that might not be such a good thing in SQL. Consider this statement which would have been written in the traditional syntax as SELECT a b c FROM Foo Bar Flub WHERE Foo.y BETWEEN Bar.x AND Flub.z With the infixed syntax I can write this same statement in any of several ways. For example SELECT FROM Foo INNER JOIN Bar ON Foo.y Bar.x INNER JOIN Flub ON Foo.y Flub.z Humans tend to see things that are close together as a unit or as having a relationship. The extra reserved words in the infixed notation tend to work against that perception. The infixed notation invites a programmer to add one table at a time to the chain of joins. First I built and tested the Foo-Bar join and when I was happy with the results I added Flub. Step-wise program refinement was one of the mantras of structured programming. But look at the code can you see that there is a between relationship among the three tables It is not easy is it In effect you see only pairs of tables and not the whole problem. SQL is an all-at-once set-oriented language not a step-wise language. Technically the SQL engine is supposed to perform the infixed joins in left to right order as they appear in the from clause. It is free to rearrange the order of the joins if the rearrangement does not change 17.4 Scope of Derived Table Names 353 the results. Order of execution does not make a difference with inner joins but it is very important with OUTER joins. .