AnyLogic
Expand
Font size

SelectQuery

You can work with database tables with the help of the functions listed below:

Functions

General
Function Description
ResultSet getResults(Expression<?>... columns) Returns the results as JDBC result set.

columns — columns to select from.
long count() Returns the number of rows matching the given criteria.
boolean exists() Returns true, if rows matching the given criteria exist, otherwise returns false.
Grouping (GROUP BY)
Function Description
SelectQuery groupBy(Expression<?>... columns) Defines GROUP BY statement columns.

columns — columns for grouping.
SelectQuery groupBy(Expression<?> column) Defines GROUP BY statement columns. column — column for grouping.
Ordering (ORDER BY)
Function Description
SelectQuery orderBy(OrderSpecifier<?>... orderSpecifiers) Defines ORDER BY specifiers.

orderSpecifiers — order specifiers, for example: db_table.db_column.asc().
SelectQuery orderBy(OrderSpecifier<?> orderSpecifier) Defines ORDER BY specifier.

orderSpecifier — order specifier, for example: db_table.db_column.asc().
Join (RIGHT JOIN)
Function Description
SelectQuery rightJoin(EntityPath<?> table) Adds a right join to the query.

table — table to join.
<E> SelectQuery rightJoin(ForeignKey<E> key, RelationalPath<E> table) Adds a right join to the query.

key — foreign key to make join.
table — table to join.
How can we improve this article?