annotate tests/agg.ur @ 579:0094e0242100

Propagated a source change into a dynamic document element
author Adam Chlipala <adamc@hcoop.net>
date Tue, 30 Dec 2008 15:53:04 -0500
parents 7a7efbb3e354
children ad9829c3c12c
rev   line source
adamc@235 1 table t1 : {A : int, B : string, C : float}
adamc@235 2 table t2 : {A : float, D : int}
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@237 8
adamc@237 9 (*val q5 = (SELECT t1.A FROM t1 GROUP BY t1.B)*)
adamc@237 10 val q5 = (SELECT SUM(t1.A) AS X FROM t1 GROUP BY t1.B)
adamc@265 11
adamc@265 12
adamc@265 13 datatype list a = Nil | Cons of a * list a
adamc@265 14
adamc@266 15 val r1 : transaction (list string) =
adamc@266 16 query q4
adamc@265 17 (fn fs acc => return (Cons (fs.X, acc)))
adamc@265 18 Nil
adamc@265 19
adamc@265 20 val main : unit -> transaction page = fn () =>
adamc@265 21 n <- r1;
adamc@265 22 return <html><body>Nothing to see here!</body></html>