Joe Celko s SQL for Smarties - Advanced SQL Programming P54

Joe Celko s SQL for Smarties - Advanced SQL Programming P54. 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. | 502 CHAPTER 22 AUXILIARY TABLES THEN RETURN xl END IF END IF try again with new guess using two-point formula SET x2 xl SET f2 NPV x2 IF f2 IS NULL -- no irr THEN RETURN f2 END IF IF ABS f2 - fl THEN RETURN CAST NULL AS FLOAT check for divide by zero END IF SET guess xl - fl x2 - xl f2 - fl SET maxtry maxtry - l END WHILE END Test table holds results of straight line algorithm CREATE TABLE Test_StraightLine rate DECIMAL 7 5 NOT NULL npv FLOAT irr DECIMAL 7 5 CREATE TABLE Test_BoundedBox rate DECIMAL 7 5 NOT NULL npv FLOAT irr DECIMAL 7 5 -- original scenario try t 0 cashflow of - 39l irr undefined try t 0 cashflow of -350 irr multivalued -- 0 irr single-valued well-behaved DELETE FROM CashFlows INSERT INTO CashFlows VALUES 0 -350 l l00 2 l00 3 l00 4 l00 5 l00 6 l00 7 l00 8 l00 9 l00 l0 l00 ll l00 l2 l00 l3 l00 l4 l00 l5 -l500 Auxiliary Function Tables 503 -- scenario 1a single valued irr DELETE FROM CashFlows INSERT INTO CashFlows VALUES 0 -800 1 100 2 100 3 100 4 100 5 100 6 100 7 100 8 100 9 100 10 100 scenario 1b single valued irr signs reversed DELETE FROM Cashflows INSERT INTO Cashflows VALUES 0 800 1 -100 2 -100 3 -100 4 -100 5 -100 6 -100 7 -100 8 -100 9 -100 10 -100 scenario 2 double valued irr DELETE FROM CashFlows INSERT INTO CashFlows VALUES 0 -300 1 100 2 100 3 100 4 100 5 100 6 100 7 100 8 100 9 100 10 -690 scenario 3 double valued irr with solutions very CLOSE together DELETE FROM Cashflows INSERT INTO Cashflows VALUES 0 -310 1 100 2 100 3 100 4 100 5 100 6 100 7 100 8 100 9 100 10 -690 scenario 4 undefined irr DELETE FROM CashFlows INSERT INTO CashFlows VALUES 0 -320 1 100 2 100 3 100 4 100 5 100 6 100 7 100 8 100 9 100 10 -690 run the test DELETE FROM Test_StraightLine INSERT INTO Test_StraightLine rate npv irr SELECT rate NPV rate irr_sl rate FROM Rates 504 CHAPTER 22 AUXILIARY TABLES DELETE FROM Test_BoundedBox INSERT INTO Test_BoundedBox rate npv irr SELECT rate NPV rate irr_bb rate FROM Rates View results of the test SELECT .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
24    21    1    30-11-2024
Đã 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.