Type parameters
Constructors
constructor
• new Relation<Expr>(expression)
Type parameters
Parameters
Properties
expressionType
•Readonly expressionType: Expr
expression
•Readonly expression: RelationExpression
Methods
as
▸ as<Name>(alias): Relation<Alias<Expr, Name>>
Type parameters
Parameters
Returns
Relation<Alias<Expr, Name>>
filter
▸ filter<Predicate>(predicate): Relation<Filter<Expr, Predicate>>
Type parameters
Parameters
Returns
Relation<Filter<Expr, Predicate>>
select
▸ select<Fields>(fields): Relation<Select<Expr, Fields>>
Type parameters
Parameters
Returns
Relation<Select<Expr, Fields>>
leftJoin
▸ leftJoin<Right, Options>(right, options): Relation<Join<Expr, Right, "left", Options>>
Type parameters
Parameters
Returns
Relation<Join<Expr, Right, "left", Options>>
innerJoin
▸ innerJoin<Right, Options>(right, options): Relation<Join<Expr, Right, "inner", Options>>
Type parameters
Parameters
Returns
Relation<Join<Expr, Right, "inner", Options>>
exists
▸ exists<Right, Options>(right, options): Relation<Join<Expr, Right, "semi", Options>>
Keep each row, once, when at least one row of right has equal keys
(an existence or semi join). Rows are never multiplied and the result
has this relation’s fields only, so right needs no alias. Keys compare
as every join’s do: null equals null, a missing value equals only a
missing value. Only relations over virtual tables accept it; views refuse it.
Type parameters
Parameters
Returns
Relation<Join<Expr, Right, "semi", Options>>
notExists
▸ notExists<Right, Options>(right, options): Relation<Join<Expr, Right, "anti", Options>>
Keep each row, once, when no row of right has equal keys (an anti
join). A row whose key is null is kept only when right has no null
key. Otherwise as exists.
Type parameters
Parameters
Returns
Relation<Join<Expr, Right, "anti", Options>>
aggregate
▸ aggregate<Name, From, Aggregates>(alias, options): Relation<Aggregate<Expr, Name, From, Aggregates>>
Add alias to each row: the measures of the rows of from related to
it. A row whose related rows are none gets zero counts and sums, and no
percentile; a denied or unavailable read refuses instead.
Type parameters
Parameters
Returns
Relation<Aggregate<Expr, Name, From, Aggregates>>
groupBy
▸ groupBy<Fields>(fields, window?): Object
Type parameters
Parameters
Returns
Object
orderBy
▸ orderBy(keys): Relation<Sort<Expr>>
Rows in the order of keys, ties broken by the complete row ascending.
Ascending order places a missing field first, then null, then values;
text compares by UTF-8 bytes. Only relations over virtual tables accept a sort;
views refuse it.
Parameters
Returns
Relation<Sort<Expr>>
limit
▸ limit(rows): Relation<Sort<Expr>>
The first rows rows (top-N). After orderBy they are the first rows
of that order; otherwise of the complete row ascending, so a limit never
picks arbitrary rows. A limit changes the answer. maxRowSteps bounds
the work needed to produce that answer, including intermediate rows.
Parameters
Returns
Relation<Sort<Expr>>