module Aggregatable
Overview
Handles aggregate functions.
Defined in:
query/aggregatable.crInstance Method Summary
-
#avg(column : Symbol)
Adds an AVG aggregate function to the query.
-
#count(column : Symbol = :*)
Adds a COUNT aggregate function to the query.
-
#max(column : Symbol)
Adds a MAX aggregate function to the query.
-
#min(column : Symbol)
Adds a MIN aggregate function to the query.
-
#sum(column : Symbol)
Adds a SUM aggregate function to the query.
Instance Method Detail
def avg(column : Symbol)
#
Adds an AVG aggregate function to the query.
Example Calculating the average value
query.avg(:age)
=> 100
def count(column : Symbol = :*)
#
Adds a COUNT aggregate function to the query.
Example Counting all rows
query.count
=> 100
def max(column : Symbol)
#
Adds a MAX aggregate function to the query.
Example Finding the maximum value
query.max(:age)
=> 100
def min(column : Symbol)
#
Adds a MIN aggregate function to the query.
Example Finding the minimum value
query.min(:age)
=> 100
def sum(column : Symbol)
#
Adds a SUM aggregate function to the query.
Example Summing all values
query.sum(:age)
=> 100