In this chapter you will learn:
About compute by statement
Syntax of compute by statement
Example of compute by statement
About compute by statement
The sql clause compute by used with SELECT statement to calculate summary values of the result on a group of data. The column on which the data grouped is declared after BY keyword. It generates the summary report with individual data rows from the table.
Syntax of compute by statement
SELECT column_list from table_name compute aggregate_function (column_name) BY column_name
Example of compute by statement
select * from humanresources.employee where employeeid<5 order by title compute sum(vacationHours) by Title
SUMMARY
In this chapter, you have learned about compute by clause so now try to use this clause with yourself because it will help you to better use. In the next chapter you will learn about select top clause.