---------------------------------------------------------------
-- SQL*Plus Report Example (Section 2.1.4)
-- Chapter 2; Oracle Programming -- A Primer
--            by R. Sunderraman
---------------------------------------------------------------
spool report.dat
clear columns
clear breaks
clear computes
set headsep !

ttitle 'Student Report!Fall 1996!CSc 226'
btitle 'Report prepared by R. Sunderraman'

column sid heading 'SID' format a5 word_wrapped
column lname heading 'Last Name' format a12 word_wrapped
column fname heading 'First Name' format a10 word_wrapped
column compname heading 'Component' format a10 word_wrapped
column points heading 'Points' format 9990

break on sid skip 2 on lname on fname
compute sum of points on sid

set linesize 79
set pagesize 50
set newpage 0

select E.sid, S.lname, S.fname, C.compname, T.points
from   enrolls E, students S, components C, scores T
where  S.sid = T.sid and
       S.sid = E.sid and
       E.term = C.term and
       E.lineno = C.lineno and
       E.term = T.term and
       E.lineno = T.lineno and
       C.compname = T.compname and
       E.term = 'f96' and
       E.lineno = 1031;
spool off 
