| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
- SVN
- String Functions and Operators
- HTTP
- 오라클
- Tibero
- 티베로
- Date and Time Function
- Data and Time Functions
- 방화벽
- 윈도우
- 전자정부표준프레임워크
- MySQL
- Sring Functions and Operators
- Date and Time Functions
- String Function and Operators
- String Functions and Date Operators
- 전자정부 표준프레임워크
- Oracle
- Today
- Total
웹이야기
MySQL Arithmetic Operators 본문
MySQL 산술연산자 쯤?
Arithmetic Operators
| Name | Description |
| %, MOD | Modulo operator |
| * | Multiplication operator |
| + | Addition Operator |
| - | Minus Operator |
| - | Change the sign of the argument |
| / | Division operator |
| DIV | Integer division |
평소에 많이 봐왔던 것들이다.
DIV
Integer division. Discards from the division result any fractional part to the right of the decimal point.
If either operand has a noninteger type, the operands are converted to DECIMAL and divided using DECIMAL arithmetic before converting the result to BIGINT. If the result exceeds BIGINT range, an error occurs.
mysql> SELECT 5 DIV 2, -5 DIV 2, 5 DIV -2, -5 DIV -2 ;
+---------+----------+----------+-----------+
| 5 DIV 2 | -5 DIV 2 | 5 DIV -2 | -5 DIV -2 |
+---------+----------+----------+-----------+
| 2 | -2 | -2 | 2 |
+---------+----------+----------+-----------+
1 row in set (0.00 sec)
mysql> SELECT 5 / 2 ;
+--------+
| 5 / 2 |
+--------+
| 2.5000 |
+--------+
1 row in set (0.00 sec)
'D > MySQL' 카테고리의 다른 글
| MySQL ABS() (0) | 2020.03.26 |
|---|---|
| MySQL Mathematical Functions (0) | 2020.03.26 |
| MySQL Control Flow Functions (0) | 2020.03.19 |
| MySQL 지정 연산자 (0) | 2020.03.19 |
| MySQL 논리 연산자 (0) | 2020.03.18 |