当前位置:网站首页>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
边栏推荐
- Read the general components of antd source code
- Characteristics of ES6 arrow function
- Go Concurrency
- In depth understanding of line height and vertical align
- Word of the Day
- Understand JS high-order function and write a high-order function
- Compatible with Internet Explorer
- The construction and usage of wampserver framework
- Deep learning non local neural networks
- The k-th node of the binary search tree [sword finger offer]
猜你喜欢

Penetration test - right raising topic

Extend the toolbar of quill editor

Use serialize in egg to read and write split tables

Attack and defense world web baby Web

Deep learning non local neural networks

Voxel based and second network learning

File upload vulnerability (III)

In depth understanding of line height and vertical align

Depth of binary tree
![H5 native player [learn video]](/img/51/83a200d0423b7274d1e981ec2ede2c.jpg)
H5 native player [learn video]
随机推荐
Ctfhub eggs
1.6.3 use tcpdump to observe DNS communication process
2022.1.21 diary
Using JS to realize the sidebar of life information network
Small sample learning data set
Go deep into the working principle of browser and JS engine (V8 engine as an example)
Conflict between v-mode and v-decorator in Ant Design
2.20 learning content
CTFHub-rce
Electronic Society C language level 1 28, character diamond
Keyboard key code value
Dynamic programming example 1 leetcode 322 coin change
CSRF (Cross Site Request Forgery) &ssrf (server request forgery) (IV)
Detailed summary of float
Detailed summary of position positioning
Monkey test of APP automation
Fundamentals of C language
Can bus extended frame
Only these four instructions are required to operate SQL data
Transformations of pytorch torch torch vision