October 2002
Beginner
864 pages
18h 41m
English
Transact-SQL also has a mechanism for creating summarized database reports. The command, COMPUTE, has very similar syntax to its counterpart in SQL*Plus. (See Bonus Day 3, “Using Oracle SQL*Plus to Satisfy Reporting Needs.”)
The following query produces a report showing all batters, the number of home runs hit by each batter, and the total number of home runs hit by all batters:
select name, homeruns from batters compute sum(homeruns)
In the previous example, COMPUTE alone performed computations on the report as a whole. COMPUTE BY, on the other hand, performs computations on specified groups and the ... |
Read now
Unlock full access