일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- 윈도우
- HTTP
- String Function and Operators
- 오라클
- Sring Functions and Operators
- String Functions and Date Operators
- Date and Time Functions
- 전자정부 표준프레임워크
- Data and Time Functions
- Tibero
- Date and Time Function
- 티베로
- MySQL
- String Functions and Operators
- Oracle
- SVN
- 방화벽
- 전자정부표준프레임워크
- Today
- Total
웹이야기
MySQL TRUNCATE() 본문
TRUNCATE(X, D)
Returns the number X, truncated to D decimal places. If D is 0, the result has no decimal point or fractional part. D can be negative to cause D digits left of the decimal point of the value X to become zero.
mysql> SELECT TRUNCATE(1.223, 1);
+--------------------+
| TRUNCATE(1.223, 1) |
+--------------------+
| 1.2 |
+--------------------+
1 row in set (0.00 sec)
mysql> SELECT TRUNCATE (1.999, 1);
+---------------------+
| TRUNCATE (1.999, 1) |
+---------------------+
| 1.9 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT TRUNCATE(1.999, 0);
+--------------------+
| TRUNCATE(1.999, 0) |
+--------------------+
| 1 |
+--------------------+
1 row in set (0.00 sec)
mysql> SELECT TRUNCATE(-1.999, 1);
+---------------------+
| TRUNCATE(-1.999, 1) |
+---------------------+
| -1.9 |
+---------------------+
1 row in set (0.00 sec)
mysql> SELECT TRUNCATE(122, -2);
+-------------------+
| TRUNCATE(122, -2) |
+-------------------+
| 100 |
+-------------------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
MySQL ADDDATE() (0) | 2020.04.01 |
---|---|
MySQL Date and Time Functions (0) | 2020.03.31 |
MySQL SIN() (0) | 2020.03.29 |
MySQL SIGN() (0) | 2020.03.29 |
MySQL ROUND() (0) | 2020.03.29 |