annotate tests/agg.ur @ 1190:899875315bde

New release
author Adam Chlipala <adamc@hcoop.net>
date Thu, 25 Mar 2010 13:04:49 -0400
parents ad9829c3c12c
children 601a77af0477
rev   line source
adamc@235 1 table t1 : {A : int, B : string, C : float}
adamc@1187 2 table t2 : {A : float, D : int, E : option string}
adamc@235 3
adamc@236 4 val q1 = (SELECT COUNT( * ) AS X FROM t1)
adamc@236 5 val q2 = (SELECT AVG(t1.A) AS X FROM t1)
adamc@236 6 val q3 = (SELECT SUM(t1.C) AS X FROM t1)
adamc@236 7 val q4 = (SELECT MIN(t1.B) AS X, MAX(t1.A) AS Y FROM t1)
adamc@1187 8 val q5 = (SELECT SUM(t1.A) AS X FROM t1 GROUP BY t1.B)
adamc@1187 9 val q6 = (SELECT COUNT(t2.E) AS N FROM t2 GROUP BY t2.D)
adamc@237 10
adamc@1187 11 fun main () : transaction page =
adamc@1187 12 xml <- queryX q6 (fn r => <xml>{[r.N]};</xml>);
adamc@1187 13 return <xml><body>{xml}</body></xml>