반응형
Given the following table 'decimals':
decimals table schema
- id
- number1
- number2
Return a table with a single column towardzero where the values are the result of number1 + number2 truncated towards zero.
Solution:
SELECT
TRUNC(number1 + number2) AS towardzero
FROM
decimals
Result:
towardzero |
1 |
2 |
0 |
2 |
2 |
1 |
Reference:
반응형
'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글
SQL: Regex String to Table (0) | 2022.07.03 |
---|---|
SQL with Harry Potter: Sorting Hat Comparators (0) | 2022.07.01 |
Easy SQL: Counting and Grouping (0) | 2022.06.29 |
Countries Capitals for Trivia Night (SQL for Beginners #6) (0) | 2022.06.28 |
First and last IP in a network (0) | 2022.06.27 |