Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f98245e

Browse files
committed
Add a question
1 parent f7e7bb4 commit f98245e

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

‎README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,3 +1020,30 @@ ON Person.PersonId = Address.PersonId;
10201020
---
10211021

10221022
**[⬆ Back to Top](#sql-coding-challenges-for-beginners)**
1023+
1024+
## 34. Rounding Decimals
1025+
1026+
Given the following table `decimals`, return a table with two columns (`number1`, `number2`), where the value in `number1` is rounded down and the value in `number2` is rounded up.
1027+
1028+
```
1029+
decimals
1030+
--------
1031+
id
1032+
number1
1033+
number2
1034+
```
1035+
1036+
<details><summary>Solution</summary>
1037+
1038+
```sql
1039+
SELECT
1040+
FLOOR(number1) AS number1,
1041+
CEILING(number2) AS number2
1042+
FROM decimals;
1043+
```
1044+
1045+
</details>
1046+
1047+
---
1048+
1049+
**[⬆ Back to Top](#sql-coding-challenges-for-beginners)**

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /