当前位置:网站首页>Oracle SQL statement operand: rounding, rounding, differentiation and formatting
Oracle SQL statement operand: rounding, rounding, differentiation and formatting
2022-06-25 05:31:00 【qq_ forty-one million five hundred and fifty-four thousand six 】
use oracle sql Operate on numbers : Take up and round 、 Rounding down 、 Retain N Decimal place 、 rounding 、 Number formatting
integer ( Rounding down ):
select floor(5.534) from dual;
select trunc(5.534) from dual;
The above two usages can be used for numbers 5.534 Rounding down , The result is 5.
If you want to round up , The result is 6, You should use ceil
select ceil(5.534) from dual;
rounding :
SELECT round(5.534) FROM dual;
SELECT round(5.534,0) FROM dual;
SELECT round(5.534,1) FROM dual;
SELECT round(5.534,2) FROM dual;
The results are 6, 6, 5.5, 5.53
Retain N Decimal place ( Do not round off ):
select trunc(5.534,0) from dual;
select trunc(5.534,1) from dual;
select trunc(5.534,2) from dual;
The results are 5,5.5,5.53, Where reserved 0 Decimal places are equivalent to rounding directly .
Number formatting :
select to_char(12345.123,'99999999.9999') from dual;
The result is 12345.123
select to_char(12345.123,'99999999.9900') from dual;
The third and fourth after the decimal place are insufficient 0, The result is 12345.1230
select to_char(0.123,'99999999.9900') from dual;
select to_char(0.123,'99999990.9900') from dual;
The results are .123, 0.123
Take a percentage
select 100*round(COUNT(*)/SUM(COUNT(*)) OVER(),4)||'%'percent FROM Table name
边栏推荐
- Deep analysis of epoll reactor code
- Detailed summary of position positioning
- Design of IM login server and message server
- PHP calls map API
- Essais de pénétration - sujets d'autorisation
- A review of small sample learning
- CUDA compilation error
- Dynamic programming example 2 leetcode62 unique paths
- I got to know data types and function variables for the first time. I learned data types and function variables together today and yesterday, so I saved them in the first issue to record.
- Electronic Society C language level 1 28, character diamond
猜你喜欢

HR took the initiative to raise the salary of the test lady. How did she do it?

Customize the console plot result style

Flex flexible layout for mobile terminal page production

Baidu ueeditor set toolbar initial value

Five simple data types of JS

SQL lab range explanation

CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)

Eyeshot Ultimate 2022 Crack By Xacker
![[day40 literature extensive reading] space and time in the child's mind: metallic or atomic](/img/98/10b3e63c9609990c51b619d9ca6179.jpg)
[day40 literature extensive reading] space and time in the child's mind: metallic or atomic

Reading and writing of nodejs excel (.Xlsx) files
随机推荐
JS verification code input number auto skip
Edge loss 解读
1.5.3 use tcpdump to observe ARP communication process
Pytorch- daily learning notes of some small functions involving training
Voxel based and second network learning
Makefile Foundation
H5 canvas drawing circle drawing fillet [detailed explanation]
Monkey test of APP automation
CUDA compilation error
2022.1.21 diary
Summary of SQL injection (I)
Ctfhub eggs
Compatible with Internet Explorer
"APEC industry +" biov Tech talks about the cross-border of Chinese biotechnology enterprises and "Pratt & Whitney Kangyu" | apec-hub public welfare
PHP calls map API
Dynamic programming Backpack - 01 Backpack
Penetration test - right raising topic
A summary of the experiment of continue and break in C language
Try block and exception handling
Could not find “store“ in the context of “Connect(homePage)