Page History
...
Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
Example
Code Block |
---|
SELECT DEGREES(A) FROM Employee |
...
EXP
Returns Euler's number e raised to the power of a numeric value.
Example
Code Block |
---|
SELECT EXP(LOG(20)), LOG(EXP(20)) FROM Employee |
...
FLOOR
Returns the largest integer less than or equal to the specified numeric expression.
Example
Code Block |
---|
SELECT FLOOR(Salary), FLOOR(-123.45), FLOOR(123.45) FROM Employee |
...
LOG, LOG10
LOG returns the natural logarithm whereas LOG10 returns the base-10 logarithm.
Example
Code Block |
---|
SELECT LOG(ID) FROM Employee |
Example
Code Block |
---|
SELECT LOG10(ID) FROM Employee |
...
RADIANS
Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
Example
Code Block |
---|
SELECT RADIANS(A) FROM Employee |
...
SQRT
Returns the square root of a numerical value.
Example
Code Block |
---|
SELECT SQRT(Salary) FROM Employee |
...
PI
Returns the value of PI.
Example
Code Block |
---|
SELECT PI() FROM Employee |
...
POWER
Returns the base to the exponent power of a numerical value.
Example
Code Block |
---|
SELECT POWER(ID,3) FROM Employee |
...
RAND
Calling the function without parameter returns the next pseudo random number. Calling it with a parameter seeds the session's random number generator. This method returns a double between 0 (including) and 1 (excluding).
Example
Code Block |
---|
SELECT * FROM Employee ORDER BY RAND() |
...
RANDOM_UUID
Returns a new UUID with 122 pseudo random bits.
Example
Code Block |
---|
SELECT * FROM Employee ORDER BY RANDOM_UUID() |
...
ROUND
Rounds to a number of digits, or to the nearest long if the number of digits is not set. This method returns a numeric (the same type as the input).
Example
Code Block |
---|
SELECT First_name, ROUND(Salary, 1) FROM Employee |
...
SECURE_RAND
Generates a number of cryptographically secure random numbers. This method returns bytes.
Example
Code Block |
---|
SELECT SECURE_RAND(16) FROM Employee |
...
SIGN
Returns -1 if the value is smaller than 0, 0 if zero, and otherwise 1.
Example
Code Block |
---|
SELECT SIGN(ID) FROM Employee |
...
ENCRYPT
Encrypts data using a key. The supported algorithm is AES. The block size is 16 bytes. This method returns bytes.
Example
Code Block |
---|
SELECT ENCRYPT('AES', '00', STRINGTOUTF8('Test')) FROM Employee |
...
DECRYPT
Decrypts data using a key. The supported algorithm is AES. The block size is 16 bytes. This method returns bytes.
Example
Code Block |
---|
SELECT DECRYPT('AES', '00', STRINGTOUTF8('Test')) FROM Employee |
...
HASH
Calculates the hash value using an algorithm, and repeats this process for a number of iterations. Currently, the only algorithm supported is SHA256. This method returns bytes.
Example
Code Block |
---|
SELECT HASH('SHA256', STRINGTOUTF8('Password'), 1000) FROM Employee |
...
TRUNCATE
Truncates to a number of digits (to the next value closer to 0). This method returns a double. When used with a timestamp, truncates a timestamp to a date (day) value. When used with a date, truncates a date to a date (day) value less time part. When used with a timestamp as string, truncates a timestamp to a date (day) value.
Example
Code Block |
---|
SELECT TRUNCATE(E_id, 2) FROM Employee |
...
COMPRESS
Compresses the data using the specified compression algorithm. Supported algorithms are: LZF (faster but lower compression; default), and DEFLATE (higher compression).
Example
Code Block |
---|
SELECT COMPRESS(STRINGTOUTF8('Jon')) FROM Employee |
...
EXPAND
Expands data that was compressed using the COMPRESS function. This method returns bytes.
Example
Code Block |
---|
SELECT UTF8TOSTRING(EXPAND(COMPRESS(STRINGTOUTF8('Jon')))) FROM Employee |
...
ZERO
Returns the value 0.
Example
...