1
0
Fork 0
arangodb/Documentation/Examples.Ahuacatl/aqlexample-simple

24 lines
1.0 KiB
Plaintext

/* a query that returns a string value. the result string is contained in a list because the result of every valid query is a list */
RETURN "this will be returned"
["this will be returned"]
/* a query that creates the cross products of two lists, and runs a projection on it */
FOR year in [ 2011, 2012, 2013 ]
FOR quarter IN [ 1, 2, 3, 4 ]
RETURN { "y" : "year", "q" : quarter, "nice" : CONCAT(TO_STRING(quarter), "/", TO_STRING(year)) }
[ { "y" : "year", "q" : 1, "nice" : "1/2011" },
{ "y" : "year", "q" : 2, "nice" : "2/2011" },
{ "y" : "year", "q" : 3, "nice" : "3/2011" },
{ "y" : "year", "q" : 4, "nice" : "4/2011" },
{ "y" : "year", "q" : 1, "nice" : "1/2012" },
{ "y" : "year", "q" : 2, "nice" : "2/2012" },
{ "y" : "year", "q" : 3, "nice" : "3/2012" },
{ "y" : "year", "q" : 4, "nice" : "4/2012" },
{ "y" : "year", "q" : 1, "nice" : "1/2013" },
{ "y" : "year", "q" : 2, "nice" : "2/2013" },
{ "y" : "year", "q" : 3, "nice" : "3/2013" },
{ "y" : "year", "q" : 4, "nice" : "4/2013" } ]