SonicBase. In-memory embedded or distributed streaming sql database

SQL Select With Functions Statement


SELECT [function(column_name)] [,select_columns] FROM table_name
function:   function to perform on select
column_name:   column to select

Supported functions

min Selects the minimum value
example: select min(age) as maxValue from persons
max Selects the maximum value
example: select max(age) as maxValue from persons
count Counts the records that match the criteria
example: select count(*) from persons where name='bob'
sum Calculates the sum of the column
example: select sum(id) as sumValue from persons
avg Selects the average value
example: select avg(distance) as avg from routes
upper Returns the value in upper case
example: select upper(name) as u from persons
lower Returns the value in lower case
example: select lower(name) as l from persons
substring Returns the substring of the selected value
example: select substring(birthPlace, 1, 12) as str from persons
length Returns the length of the selected value
example: select length(name) as n from persons