SQL Functions
SQream supports functions from ANSI SQL, as well as others for compatibility.
Summary of Functions
Built-In Scalar Functions
For more information about built-in scalar functions, see Built-In Scalar Functions.
Bitwise Operations
The following table shows the bitwise operations functions:
Function |
Description |
---|---|
Bitwise AND |
|
Bitwise NOT |
|
Bitwise OR |
|
Bitwise shift left |
|
Bitwise shift right |
|
Bitwise XOR |
Conditionals
The following table shows the conditionals functions:
Function |
Description |
---|---|
Value is in [ or not within ] the range |
|
Test a conditional expression, and depending on the result, evaluate additional expressions. |
|
Evaluate first non-NULL expression |
|
Value is in [ or not within ] a set of values |
|
Alias for COALESCE with two expressions |
|
Test a |
|
Check for |
Conversion
The following table shows the conversion functions:
Function |
Description |
---|---|
Converts a UNIX Timestamp to |
|
Converts a number to a hexadecimal string representation |
|
Converts a |
Date and Time
The following table shows the date and time functions:
Function |
Description |
---|---|
Special syntax, equivalent to CURRENT_DATE |
|
Returns the current date as |
|
Equivalent to GETDATE |
|
Extracts a date or time element from a date expression |
|
Adds an interval to a date expression |
|
Calculates the time difference between two date expressions |
|
Calculates the last day of the month of a given date expression |
|
ANSI syntax for extracting date or time element from a date expression |
|
Returns the current timestamp as |
|
Equivalent to GETDATE |
|
Truncates a date element down to a specified date or time element |
Numeric
The following table shows the arithmetic operators:
Operator |
Syntax |
Description |
---|---|---|
|
|
Converts a string to a numeric value. Identical to |
|
|
Adds two expressions together |
|
|
Negates a numeric expression |
|
|
Subtracts |
|
|
Multiplies |
|
|
Divides |
|
|
Modulu of |
For more information about arithmetic operators, see Arithmetic operators.
The following table shows the arithmetic operator functions:
Function |
Description |
---|---|
Calculates the absolute value of an argument |
|
Calculates the inverse cosine of an argument |
|
Calculates the inverse sine of an argument |
|
Calculates the inverse tangent of an argument |
|
Calculates the inverse tangent for a point (y, x) |
|
Calculates the next integer for an argument |
|
Calculates the cosine of an argument |
|
Calculates the cotangent of an argument |
|
Calculates a CRC-64 hash of an argument |
|
Converts a value from radian values to degrees |
|
Calcalates the natural exponent for an argument (ex) |
|
Calculates the largest integer smaller than the argument |
|
Calculates the natural log for an argument |
|
Calculates the 10-based log for an argument |
|
Calculates the modulu (remainder) of two arguments |
|
Returns the constant value for π |
|
Calculates x to the power of y (xy) |
|
Converts a value from degree values to radians |
|
Rounds an argument down to the nearest integer, or an arbitrary precision |
|
Calculates the sine of an argument |
|
Calculates the square root of an argument (√x) |
|
Raises an argument to the power of 2 (xy) |
|
Calculates the tangent of an argument |
|
Rounds a number to its integer representation towards 0 |
Strings
The following table shows the string functions:
Function |
Description |
---|---|
Calculates number of characters in an argument |
|
Calculates the position where a string starts inside another string |
|
Concatenates two strings |
|
Decodes or extracts binary data from a textual input string |
|
Matches if a string is the prefix of another string |
|
Returns the first number of characters from an argument |
|
Calculates the length of a string in characters |
|
Tests if a string argument matches a pattern |
|
Converts an argument to a lower-case equivalent |
|
Trims whitespaces from the left side of an argument |
|
Calculates the length of a string in bytes |
|
Calculates the position where a pattern matches a string |
|
Calculates the number of matches of a regular expression match in an argument |
|
Returns the start position of a regular expression match in an argument |
|
Replaces and returns the text column substrings of a regular expression match in an argument |
|
Returns a substring of an argument that matches a regular expression |
|
Repeats a string as many times as specified |
|
Replaces characters in a string |
|
Reverses a string argument |
|
Returns the last number of characters from an argument |
|
Tests if a string argument matches a regular expression pattern |
|
Trims whitespace from the right side of an argument |
|
Returns a substring of an argument |
|
Trims whitespaces from an argument |
|
Converts an argument to an upper-case equivalent |
|
Return the ASCII code value of the leftmost character of a string |
User-Defined Scalar Functions
For more information about user-defined scalar functions, see Scalar SQL UDF.
Aggregate Functions
The following table shows the aggregate functions:
Function |
Aliases |
Description |
---|---|---|
Calculates the average of all of the values |
||
Calculates the Pearson correlation coefficient |
||
Calculates the count of all of the values or only distinct values |
||
Calculates population covariance of values |
||
Calculates sample covariance of values |
||
Returns maximum value of all values |
||
Returns minimum value of all values |
||
Calculates the sum of all of the values or only distinct values |
||
|
Calculates sample standard deviation of values |
|
|
Calculates population standard deviation of values |
|
|
Calculates sample variance of values |
|
|
Calculates population variance of values |
For more information about aggregate functions, see Aggregate Functions.
Window Functions
The following table shows the window functions:
Function |
Description |
---|---|
Calculates the value evaluated at the row that is before the current row within the partition |
|
Calculates the value evaluated at the row that is after the current row within the partition |
|
Calculates the maximum value |
|
Calculates the minimum value |
|
Calculates the sum of all of the values |
|
Calculates the rank of a row |
|
Returns the value in the first row of a window |
|
Returns the value in the last row of a window |
|
Returns the value in a specified |
|
Returns the rank of the current row with no gaps |
|
Returns the relative rank of the current row |
|
Returns the cumulative distribution of rows |
|
Returns an integer ranging between |
For more information about window functions, see Window Functions.
Workload Management Functions
The following table shows the workload management functions:
Function |
Description |
---|---|
Add a SQream DB worker to a service queue |
|
Remove a SQream DB worker to a service queue |
|
Return a list of service queues and workers |