name |
synopsis |
signature |
options |
example |
|
allbut |
Projects a subset of attributes away. |
operand: Relation, attributes: AttrList |
allbut: Boolean |
allbut(suppliers, [:city]) |
Try it!
allbut(suppliers, [:city])
|
extend |
Extends input tuples with derived/computed attributes |
operand: Relation, ext: TupleComputation |
|
extend(suppliers,
big: ->(t){ t.name.upcase },
small: ->(t){ t.name.downcase }) |
Try it!
extend(suppliers,
big: ->(t){ t.name.upcase },
small: ->(t){ t.name.downcase })
|
frame |
Aka limit/offset |
operand: Relation, order: Ordering, offset: Integer, limit: Integer |
|
frame(suppliers, [:status, :sid], 0, 3) |
Try it!
frame(suppliers, [:status, :sid], 0, 3)
|
group |
Relation-valued attribute |
operand: Relation, attributes: AttrList, as: AttrName |
allbut: Boolean |
group(suppliers, [:sid, :name, :status], :suppliers) |
Try it!
group(suppliers, [:sid, :name, :status], :suppliers)
|
image |
Extend the left operand with a new relation-valued attribute, image of the
tuple in the right relation. |
left: Relation, right: Relation, as: AttrName |
|
image(suppliers, shipments, :supplying) |
Try it!
image(suppliers, shipments, :supplying)
|
intersect |
Logical AND |
left: Relation, right: Relation |
|
intersect(
restrict(suppliers, eq(:city, 'Paris')),
restrict(suppliers, gt(:status, 10))) |
Try it!
intersect(
restrict(suppliers, eq(:city, 'Paris')),
restrict(suppliers, gt(:status, 10)))
|
join |
Natural join |
left: Relation, right: Relation |
|
join(suppliers, shipments) |
Try it!
join(suppliers, shipments)
|
matching |
Aka 'where exists' |
left: Relation, right: Relation |
|
matching(suppliers, shipments) |
Try it!
matching(suppliers, shipments)
|
minus |
Logical AND NOT |
left: Relation, right: Relation |
|
minus(
restrict(suppliers, eq(:city, 'Paris')),
restrict(suppliers, gt(:status, 10))) |
Try it!
minus(
restrict(suppliers, eq(:city, 'Paris')),
restrict(suppliers, gt(:status, 10)))
|
not_matching |
Aka 'where not exists' |
left: Relation, right: Relation |
|
not_matching(suppliers, shipments) |
Try it!
not_matching(suppliers, shipments)
|
page |
Pagination |
operand: Relation, ordering: Ordering, nth: Integer |
page_size: Integer |
page(suppliers, [:status, :sid], 1, page_size: 3) |
Try it!
page(suppliers, [:status, :sid], 1, page_size: 3)
|
project |
Keeps only a subset of attributes. |
operand: Relation, attributes: AttrList |
allbut: Boolean |
project(suppliers, [:city]) |
Try it!
project(suppliers, [:city])
|
rank |
Tuple ranking |
operand: Relation, order: Ordering, as: AttrName |
|
rank(suppliers, [:status], :ranking) |
Try it!
rank(suppliers, [:status], :ranking)
|
rename |
Rename attributes |
operand: Relation, renaming: Renaming |
|
rename(suppliers, :sid => :supplier_id, :city => :lives_in) |
Try it!
rename(suppliers, :sid => :supplier_id, :city => :lives_in)
|
restrict |
Predicate-based filtering |
operand: Relation, predicate: Predicate |
|
restrict(suppliers, city: 'Paris', status: 20) |
Try it!
restrict(suppliers, city: 'Paris', status: 20)
|
summarize |
Aggregate and compute |
operand: Relation, by: AttrList, aggs: Summarization |
allbut: Boolean |
summarize(shipments, [:sid], total: sum(:qty)) |
Try it!
summarize(shipments, [:sid], total: sum(:qty))
|
ungroup |
Inverse of group |
operand: Relation, rva: AttrName |
|
ungroup(group(suppliers, [:city], :suppliers, allbut: true), :suppliers) |
Try it!
ungroup(group(suppliers, [:city], :suppliers, allbut: true), :suppliers)
|
union |
Logical OR |
left: Relation, right: Relation |
|
union(project(suppliers, [:city]), project(parts, [:city])) |
Try it!
union(project(suppliers, [:city]), project(parts, [:city]))
|
unwrap |
Inverse of wrap |
operand: Relation, tva: AttrName |
|
unwrap(wrap(suppliers, [:city, :status], :extra), :extra) |
Try it!
unwrap(wrap(suppliers, [:city, :status], :extra), :extra)
|
wrap |
Tuple-valued attribute |
operand: Relation, attributes: AttrList, as: AttrName |
allbut: Boolean |
wrap(suppliers, [:city, :status], :extra) |
Try it!
wrap(suppliers, [:city, :status], :extra)
|