-
-
Notifications
You must be signed in to change notification settings - Fork 624
Expand file tree
/
Copy path08_Number_Functions.sql
More file actions
34 lines (29 loc) · 1.28 KB
/
Copy path08_Number_Functions.sql
File metadata and controls
34 lines (29 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ==============================================================================
SQL Number Functions Guide
-------------------------------------------------------------------------------
This document provides an overview of SQL number functions, which allow
performing mathematical operations and formatting numerical values.
Table of Contents:
1. Rounding Functions
- ROUND
2. Absolute Value Function
- ABS
=================================================================================
*/
/* ==============================================================================
ROUND() - Rounding Numbers
=============================================================================== */
-- Demonstrate rounding a number to different decimal places
SELECT
3.516 AS original_number,
ROUND(3.516, 2) AS round_2,
ROUND(3.516, 1) AS round_1,
ROUND(3.516, 0) AS round_0
/* ==============================================================================
ABS() - Absolute Value
=============================================================================== */
-- Demonstrate absolute value function
SELECT
-10 AS original_number,
ABS(-10) AS absolute_value_negative,
ABS(10) AS absolute_value_positive