The aggregate functions generate summary values that appear as new columns in the query results. Table 15-6 lists the aggregate functions, their arguments, and the results they return.
Examples are as follows:
select avg(advance), sum(total_sales) from titles where type = "business"
------------------------ ----------- 6281.25 30,788 (1 row affected)
select count(distinct city) from authors
----------- 16 (1 row affected)
select discount from salesdetail compute max(discount)
discount -------------------- 40.000000 ... 46.700000 Compute Result: -------------------- 62.200000 (117 rows affect)
select min(au_lname) from authors
--------------------- Bennet (1 row affected)
Copyright © 2005. Sybase Inc. All rights reserved. |