SQL Functions¶
BLUE supports functions from ANSI SQL, as well as others for compatibility.
Built-In Scalar Functions¶
Bitwise Operations¶
Function |
Description |
---|---|
Bitwise AND |
|
Bitwise NOT |
|
Bitwise OR |
|
Bitwise shift left |
|
Bitwise shift right |
|
Bitwise XOR |
Conditional Functions¶
Function |
Description |
---|---|
Test a conditional expression, and depending on the result, evaluate additional expressions. |
|
Evaluate first non-NULL expression |
|
Alias for COALESCE with two expressions |
|
Test a |
|
Check for |
Conversion Functions¶
Function |
Description |
---|---|
Converts a UNIX Timestamp to |
|
Converts a number to a hexadecimal string representation |
|
Converts a |
|
Returns the ASCII character representation of the supplied integer |
|
Checks whether a cast operation is possible or supported for a given column and data type and provides an alternative when there is an exception |
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 Functions¶
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 |
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 |
|
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 |
|
Returns a value of -1, 0, or 1, depending on the sign of the input argument |
|
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 Functions¶
Function |
Description |
---|---|
Calculates number of characters in an argument |
|
Calculates the position where a string starts inside another string |
|
Concatenates two strings |
|
Calculates a CRC-64 hash of an argument |
|
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 |
|
Returns an |
User-Defined Scalar Functions¶
Function |
---|
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 |
||
Returns the value located in the selected percentile of a specified column |
||
Returns an exact value located in the selected percentile of a specified column based on the closest values in your data to the requested percentile |
||
|
Calculates population standard deviation of values |
|
|
Calculates sample standard deviation of values |
|
Calculates the sum of all of the values or only distinct values |
||
|
Calculates population variance of values |
|
|
Calculates sample variance of values |
Window Functions¶
The following table shows the window functions:
Function |
Description |
---|---|
Returns the cumulative distribution of rows |
|
Returns the rank of the current row with no gaps |
|
Returns the value in the first row of a window |
|
Calculates the value evaluated at the row that is before the current row within the partition |
|
Returns the value in the last row of a window |
|
Calculates the value evaluated at the row that is after the current row within the partition |
|
Returns the value in a specified |
|
Returns an integer ranging between |
|
Returns the relative rank of the current row |
|
Calculates the maximum value |
|
Calculates the minimum value |
|
Calculates the sum of all of the values |
|
Calculates the rank of a row |
|
Returns the row number of each row within the partition of a result set |