반응형
Given the following table 'decimals':
** decimals table schema **
- id
- number1
- number2
Return a table with two columns (number1, number2), the value in number1 should be rounded down and the value in number2 should be rounded up.
Solution:
SELECT
FLOOR(number1) as number1,
CEIL(number2) as number2
FROM
decimals
Result:
number1 | number2 |
2409 | -261 |
1411 | -4694 |
2666 | -2280 |
3616 | -2987 |
4110 | -2420 |
3654 | -1463 |
Reference:
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
Easy SQL: Bit Length (0) | 2022.06.02 |
---|---|
Easy SQL: ASCII Converter (0) | 2022.05.31 |
Easy SQL: Moving Values (0) | 2022.05.29 |
Grasshopper - Terminal game move function (0) | 2022.05.29 |
Easy SQL: Cube Root and Natural Log (0) | 2022.05.27 |