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

Joe Celko s SQL for Smarties - Advanced SQL Programming P32. 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. | 282 CHAPTER 13 BETWEEN AND OVERLAPS PREDICATES celebration. A little algebra tells you that the length of an event is date - date INTERVAL 1 DAY and that the length of a guest s stay is INTERVAL 1 DAY . Let s do one of those timeline charts again ---------------- Figure Timeline Diagram. What we want is the part of the Guests interval that is inside the Celebrations interval. Guests 1 and 2 spent only part of their time at the celebration Guest 3 spent all of his time at the celebration and Guest 4 stayed even longer than the celebration. That interval is defined by the two points GREATEST arrival date start date LEAST depart date finish date . Instead you can use the aggregate functions in SQL to build a view on a view like this CREATE VIEW Working guest_name celeb_name entered exited AS SELECT start_date finish_date FROM GuestCelebrations AS GE Celebrations AS E1 WHERE UNION SELECT arrival_date depart_date FROM GuestCelebrations AS GE Guests AS G1 WHERE VIEW Working guest_name celeb_name entered exited Dorothy Gale Dorothy Gale Apple Month Apple Month 2005-02-01 2005-02-01 2005-02-28 2005-11-01 Dorothy Gale Garlic Festival 2005-02-01 2005-11-01 Dorothy Gale Garlic Festival 2005-01-15 2005-02-15 Dorothy Gale St. Fred s Day 2005-02-01 2005-11-01 OVERLAPS Predicate 283 Dorothy Gale Dorothy Gale Dorothy Gale Indiana Jones Indiana Jones Indiana Jones Indiana Jones Indiana Jones Indiana Jones Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote Don Quixote James T. Kirk James T. Kirk James T. Kirk James T. Kirk James T. Kirk James T. Kirk James T. Kirk Santa Claus Santa Claus Santa Claus St. Fred s Day Year of the Prune Year of the Prune Apple Month Apple Month Garlic Festival Garlic Festival Year of the Prune

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.