TAILIEUCHUNG - Joe Celko s SQL for Smarties - Advanced SQL Programming P63

Joe Celko s SQL for Smarties - Advanced SQL Programming P63. 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. | 592 CHAPTER 26 SET OPERATIONS For the rest of this discussion let us create two tables with the same structure which we can use for examples. CREATE TABLE S1 al CHAR l INSERT INTO S1 VALUES a a b b c CREATE TABLE S2 a2 CHAR l INSERT INTO S2 VALUES a b b b c d UNION and UNION ALL unions have been supported since SQL-86 with this infixed syntax table expression UNION ALL table expression The two versions of the union statement take two tables and build a result table from them. The two tables must be union-compatible which means that they have exactly the same number of columns and that each column in the first table has the same data type or automatically cast to it as the column in the same position in the second table. That is their rows must have the same structure so they can be put in the same final result table. Most implementations will do some data type conversions to create the result table but this can depend on your implementation and you should check it out for yourself. There are two forms of the union statement the union and the UNION ALL. The simple UNION is the same operator you had in high school set theory it returns the rows that appear in either or both tables and removes redundant duplicates from the result table. The phrase redundant duplicates sounds funny but it means that you leave one copy of the row in the table. The sample tables will yield SELECT al FROM S1 UNION SELECT a2 FROM S2 a b c d UNION and UNION ALL 593 In many early SQL implementations merge-sorting the two tables and discarding duplicates during the sorting did this removal. This had the side effect that the result table was sorted but you could not depend on that. Later implementations use hashing indexing and parallel processing to find the duplicates. The union all preserves the duplicates from both tables in the result table. Most early implementations simply appended one table to the other in physical storage. They used file systems based on physically .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.