factor/extra/db/sql/sql-tests.factor

41 lines
1002 B
Factor
Raw Normal View History

2008-03-11 21:23:22 -04:00
USING: kernel namespaces db.sql sequences math ;
2008-03-07 21:10:23 -05:00
IN: db.sql.tests
2008-04-17 20:43:07 -04:00
! TUPLE: person name age ;
2008-03-07 21:10:23 -05:00
: insert-1
{ insert
{ table "person" }
{ columns "name" "age" }
{ values "erg" 26 }
} ;
: update-1
{ update "person"
{ set { "name" "erg" }
{ "age" 6 } }
{ where { "age" 6 } }
} ;
: select-1
{ select
{ columns
"branchno"
{ count "staffno" as "mycount" }
{ sum "salary" as "mysum" } }
{ from "staff" "lol" }
{ where
{ "salary" > all
{ select
{ columns "salary" }
{ from "staff" }
2008-04-15 22:55:26 -04:00
{ where { "branchno" = "b003" } }
2008-03-07 21:10:23 -05:00
}
}
{ "branchno" > 3 } }
{ group-by "branchno" "lol2" }
{ having { count "staffno" > 1 } }
{ order-by "branchno" }
{ offset 40 }
{ limit 20 }
} ;