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

Joe Celko s SQL for Smarties - Advanced SQL Programming P19. 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. | 152 CHAPTER 4 TEMPORAL DATA TYPES IN SQL UPDATE Lots SET to_date DATE 1998-10-01 WHERE lot_id 234 AND from_date DATE 1998-10-01 AND to_date DATE 1998-10-01 UPDATE Lots SET from_date DATE 1998-10-22 WHERE lot_id 234 AND from_date DATE 1998-10-22 AND to_date DATE 1998-10-22 DELETE FROM Lots WHERE lot_id 234 AND from_date DATE 1998-10-01 AND to_date DATE 1998-10-22 Case 1 is reflected in the first two statements the second statement also covers case 2. The third statement handles case 3 and the fourth case 4. All four statements must be evaluated in the order shown. They have been carefully designed to cover each case exactly once. A sequenced update is the temporal analog of a nontemporal update with a specified period of applicability. Let us again consider steering the cattle in lot 799. UPDATE Lots SET gender_code s WHERE lot_id 799 We now convert this to a sequenced update. As with sequenced deletions there are more cases to consider for sequenced updates as compared with current updates. The four cases shown below are handled differently in an update. In case 1 the initial and final portions of the period of validity are retained via two insertions and the affected portion is updated. In case 2 only the initial portion is retained in case 3 only the final portion is retained. In case 4 the period of validity is retained as it is covered by the period of applicability. In summary we need to 1. Insert the old values from the from_date to the beginning of the period of applicability. The Nature of Temporal Data Models 153 2. Insert the old values from the end of the period of applicability to the to_date. 3. Update the explicit columns of rows that overlap the period of applicability 4. Update the from_date to begin at the beginning of the period of applicability of rows that overlap the period of applicability. 5. Update the to_date to end at the end of the period of applicability of rows that overlap the period of applicability. Case 1 .

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.