Need help?
Ask a question or report a problem on GitHub.
Open an issue
The query language
For everyday reading of data you do not need to write SQL. get, where, order by and the aggregate words read like the question you are asking.
Not part of Otter 1.0. The query language is deferred to Otter 1.1 (decision D99). It is in the current source tree as an experimental preview: its syntax and behavior may change before 1.1, and programs that need SQL today can use query and execute (see Databases), which are also a preview outside the certified Otter 1.0 surface.
Getting rows
Otter
get all from items in db into allItems say "Count:" length of allItems get name and price from items in db with order by price descending into sortedItems
Filtering with where
Conditions use the same words as if: is, is not, is at least, is less than, and, or, not, contains, is in, is between, and is gone for missing values. Values are always passed to the database as parameters, so text from a user cannot change the meaning of the query.
Otter
minAge is 18 get all from users in db with where age is at least minAge and active is 1 into adultActives term is "Apple" get all from products in db with where name contains term order by sku ascending into appleProducts targetCats are "Snacks" "Bakery" . get all from products in db with where category is in targetCats into catProducts get all from tasks in db with where due_date is gone into unscheduled
Paging
Otter
pageSize is 3 pageOffset is 3 get all from num_seq in db with order by val ascending limit pageSize offset pageOffset into page2
Counting and totals
Otter
count all from scores in db into allCount count of student from scores in db into studentCount sum of score from scores in db into sumScores average of score from scores in db into avgScores minimum of score from scores in db into minScore maximum of score from scores in db into maxScore sum of score from scores in db with where pass is 1 into passingSum
Back to databases