Results: 1022
Converts the first argument from one number system (the second argument) to another (the third argument) Converts
5
from
10
base system to
2
SELECT
    CONV(5, 10, 2)
POWER
Raises the first argument to the power of another argument. The code below returns
16
because
2
to the power of
4
is
16
SELECT 
    POWER(2, 4)
Note:
POW
and
POWER
are the aliases for the same command
These two functions are opposite to each other.
180
degrees converted to radians gives us
PI
:
3.141592653589793
PI
:
3.141592653589793
radians converted to degrees gives us
180
degrees.
SELECT
    RADIANS(180),
    DEGREES(3.141592653589793)
Converts degrees to radians.
90
degrees converted to radians gives us half of
PI
:
1.5707963267948966
.
180
degrees converted to radians gives us
PI
:
3.141592653589793
.
SELECT
    RADIANS(90),
    RADIANS(180)
Rounds the number up to the lowest integer value greater than the passed decimal argument. Both of the arguments will be rounded to
3
SELECT
    CEIL(2.3),
    CEIL(2.8)
Rounds the argument down to the greater integer less then the decimal argument. Both of the arguments will be rounded down to
2
SELECT
    FLOOR(2.3),
    FLOOR(2.8)
Rounds the passed value using standard Math rules. The first argument
2.3
will be rounded to 2 and the second
2.5
becomes 3
SELECT
    ROUND(2.3),
    ROUND(2.5)
The function
RPAD
appends string (third parameter) the specified number of times (second parameter) to the first parameter. In this example each one of the student's last name that is less than 10 characters long, is filled with
-
SELECT 
    RPAD(first_name, 10, '-') AS 'student name'
FROM students
The function
LEFT
returns leftmost characters. In this case 5 characters because we pass 5 as second parameter
SELECT 
    LEFT(first_name, 5) AS 'five leftmost characters'
FROM students
The function
LTRIM
remove leading spaces (removes spaces from the beginning)
SELECT 
    LENGTH(' text ') length,
    LENGTH(LTRIM(' text ')) length_with_left_trim
Results: 1022