Additional Query Solution Modifiers
The optional query modifiers enable you to restrict, group, sort, or further refine results:
- ORDER BY: This modifier sorts the result set of a query in a particular order, based on the value of one or more variables. As part of the ORDER BY clause, you specify an expression (using the value of one or more triple store variables) by which to order results. You can also optionally specify whether to return results in ascending order, ASC(expression), or descending order, DESC(expression). By default, ORDER BY results are returned in ascending order.
- OFFSET: Using this modifier in conjunction with LIMIT and ORDER BY returns a portion of a sorted query solution set. The OFFSET clause causes the result returned by a query solution to start following a specified number of results that match the query pattern. An OFFSET of zero has no effect. Using LIMIT and OFFSET to select different subsets of the query solution results is made more predictable by also using ORDER BY.
- LIMIT: This modifier puts an upper bound on the number of results returned by a query. If used with an OFFSET, the number of results returned by a query will again be restricted by the specified limit, after any OFFSET is applied, Also, the specified limit may not be negative, and a specified limit of 0 would cause no results to be returned.
- GROUP BY: This modifier is used with aggregate functions and specifies the key variables to use to partition the solution results into groups. For information about AnzoGraph GROUP BY clause extensions, see Advanced Grouping Sets.
- HAVING: This modifier is used with aggregate functions to further filters query results after applying query result aggregation.