String Functions in Queries

ArcaneDB provides a set of scalar string functions that can be applied to literal values within get and set statements. These functions transform their argument at query time.

Function

Description

upper(<string>)

Converts a string literal to uppercase.

title(<string>)

Converts a string literal to title case (first letter of each word capitalised).

Examples:

-- Filter using title-cased comparison
get * from TestBatch2 where name = title("eve");

-- Update a field to an uppercase value
set TestBatch2 ( name: upper("billy") ) where name = "Bob";

Aggregate Functions

Aggregate functions are used within a get statement to compute summary statistics over a set of records. They operate over the values of a specified field, optionally constrained by a where clause.

Syntax:

get <agg_func>(<field>), ... from <bucket> [where <condition>];

Supported aggregate functions:

Function

Description

avg(<field>)

Arithmetic mean of non-null values.

median(<field>)

Middle value when records are sorted; interpolated for even counts.

min(<field>)

Smallest value.

max(<field>)

Largest value.

stddev(<field>)

Population standard deviation.

sum(<field>)

Sum of all non-null values.

count(*)

Total number of records in the result set.

Multiple aggregate functions may be combined in a single get statement.

Examples:

get avg(price), median(price), min(price), max(price), stddev(price)
    from Products where in_stock = true;

get sum(price) from Products;

get count(*) from Products;