15.01.2013 Views

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

Oracle Database 11g The Complete Reference (Osborne ORACLE ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 14: Some Complex Possibilities 245<br />

EMILY TALBOT ANNE OF GREEN GABLES 20-JAN-02 18.00 4.00 .8<br />

******************** ---------sum<br />

.8<br />

FRED FULLER JOHN ADAMS 01-MAR-02 28.00 14.00 2.8<br />

TRUMAN 20-MAR-02 19.00 5.00 1<br />

******************** ---------sum<br />

3.8<br />

GERHARDT KENTGEN WONDERFUL LIFE 02-FEB-02 31.00 17.00 3.4<br />

THE MISMEASURE OF 05-MAR-02 20.00 6.00 1.2<br />

MAN<br />

******************** ---------sum<br />

4.6<br />

JED HOPKINS INNUMERACY 22-JAN-02 21.00 7.00 1.4<br />

******************** ---------sum<br />

1.4<br />

PAT LAVAY THE MISMEASURE OF 12-FEB-02 31.00 17.00 3.4<br />

MAN<br />

******************** ---------sum<br />

3.4<br />

ROLAND BRANDT THE SHIPPING NEWS 12-MAR-02 59.00 45.00 9<br />

THE DISCOVERERS 01-MAR-02 48.00 34.00 6.8<br />

WEST WITH THE NIGHT 01-MAR-02 48.00 34.00 6.8<br />

******************** ---------sum<br />

22.6<br />

We can eliminate the DaysOut display and focus on the late fees, showing the fees due on<br />

each of the return dates:<br />

clear compute<br />

clear break<br />

select ReturnedDate, Name,<br />

SUM((ReturnedDate-CheckoutDate -14)*0.20) LateFee<br />

from BOOKSHELF_CHECKOUT<br />

where ReturnedDate-CheckoutDate > 14<br />

group by ReturnedDate, Name<br />

order by ReturnedDate, Name;<br />

RETURNEDD NAME LATEFEE<br />

--------- -------------------- ----------<br />

20-JAN-02 EMILY TALBOT .8<br />

22-JAN-02 JED HOPKINS 1.4<br />

02-FEB-02 GERHARDT KENTGEN 3.4<br />

12-FEB-02 PAT LAVAY 3.4<br />

01-MAR-02 FRED FULLER 2.8<br />

01-MAR-02 ROLAND BRANDT 13.6<br />

03-MAR-02 DORAH TALBOT .4

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!