Summary - Number functions
- SQL course
- Beginner
- Lesson 52/115
- 5 min
Combine ROUND, ABS and MOD to do calculations.
Summary - Number functions
In this group you learned ROUND, CEIL, FLOOR, ABS, POWER, SQRT and MOD. Choosing the right function matters in calculations.
SELECT ROUND(SQRT(16), 0) AS sonuc;This query takes the square root of 16 and rounds to an integer.
The expression ROUND(SQRT(16), 0) AS sonuc is evaluated and returned.
Practice Summary - Number functions
Select the square root of price aliased as kok from products.
Starter code
-- summary calc
SELECT
FROM productsSample solution
SELECT SQRT(price) AS kok
FROM productsExpected output
kok 2.24 3.54
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which rounds up?
- FLOOR
- MOD
- CEIL Correct answer
- ABS
Explanation: CEIL always rounds up.
2 Summary - Number functions: match the terms
| Term | Meaning |
|---|---|
ROUND |
round |
CEIL |
up |
FLOOR |
down |
ABS |
absolute |