일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Oracle
- 방화벽
- 티베로
- Date and Time Functions
- Sring Functions and Operators
- 전자정부표준프레임워크
- 윈도우
- MySQL
- 오라클
- String Functions and Operators
- HTTP
- Date and Time Function
- 전자정부 표준프레임워크
- String Function and Operators
- Data and Time Functions
- Tibero
- SVN
- String Functions and Date Operators
- 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 |