Đang chuẩn bị liên kết để tải về tài liệu:
Joe Celko s SQL for Smarties - Advanced SQL Programming P18

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

Joe Celko s SQL for Smarties - Advanced SQL Programming P18. 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. | 142 CHAPTER 4 TEMPORAL DATA TYPES IN SQL WHERE L1.lot_id L2.lot_id AND L1.feedyard_id L2.feedyard_id AND L1.pen_id L2.pen_id AND L2.from_date L1.from_date AND L1.to_date L2.to_date UNION SELECT L1.lot_id L2.lot_id L1.pen_id L1.from_date L2.to_date FROM LotLocations AS L1 LotLocations AS L2 WHERE L1.lot_id L2.lot_id AND L1.feedyard_id L2.feedyard_id AND L1.pen_id L2.pen_id AND L1.from_date L2.from_date AND L2.to_date L1.to_date AND L1.from_date L2.to_date UNION SELECT L1.lot_id L2.lot_id L1.pen_id L2.from_date L1.to_date FROM LotLocations AS L1 LotLocations AS L2 WHERE L1.lot_id L2.lot_id AND L1.feedyard_id L2.feedyard_id AND L1.pen_id L2.pen_id AND L2.from_date L1.from_date AND L1.to_date L2.to_date AND L2.from_date L1.to_date UNION SELECT L1.lot_id L2.lot_id L1.pen_id L2.from_date L2.to_date FROM LotLocations AS L1 LotLocations AS L2 WHERE L1.lot_id L2.lot_id AND L1.feedyard_id L2.feedyard_id AND L1.pen_id L2.pen_id AND L2.from_date L1.from_date AND L2.to_date L1.to_date This query requires care to get the fourteen inequalities and the four select target lists correct. The cases where either the start times or the end times match are particularly vexing. The case where the two periods are identical i.e. Ll.from date L2.from date AND Ll.to date L2.to_date is covered by two of the cases the first and the last. This introduces an undesired duplicate. However the union operator automatically removes duplicates so the result is correct. 4.4 The Nature of Temporal Data Models 143 The downside of using union is that it does a lot of work to remove these infrequent duplicates generated during the evaluation of the join. We can replace union with union all which retains duplicates and generally runs faster. If we do that then we must also add the following to the predicate of the last case. AND NOT L1.from_date L2.from_date AND L1.to_date L2.to_date The result of this query contains two rows. lot_idlot_idpen_id from_date to_date 219 374 1 1998-02-25 1998-03-01 219 374 1 .

Đã 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.