Get the App
SLTechnology News&Howtos  ›  Database  › 

Analytical function of oracle function

Shulou Source: shulou.com Published: 2022-06-01 13:16:16 10月04日 Update

1. The parsing function has four over row_number dense_rank rank and four cannot be used alone.

2.select empno, sal, deptno,sum (sal) over (order by empno), sum (sal) over () from emp; views are as follows: add up by salary

3 select empno, sal, deptno

Sum (sal) over (partition by deptno)-- the sum of each department

Sum (sal) over (order by deptno)-- summation of departments

Sum (sal) over (partition by deptno order by empno)-- first divided into departments and then accumulated under their respective departments

Sum (sal) over ()

The from emp; view is as follows

4 select empno,deptno,ename

Row_number () over (order by deptno)-- increase the serial number in sequence according to the department number

Dense_rank () over (order by deptno),-- the root department number is sorted strictly according to size and can be juxtaposed.

Rank () over (order by deptno)-- the root department number is sorted strictly according to size, but it can be juxtaposed, but there will be a jump mark that should not be occupied by the other two 1s, which is directly 4.

From emp;-- order by can be followed by desc in descending order

! [] (https://s1.51cto.com/images/blog/201712/30/fec3790e195983a037edbfe9df575d8e.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)

Tags: Departments strictly according to size summation roots views sorting functions analysis two successively that is wages pipelines serial numbers order. Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux MariaDB NVidia Redmi OPPO Reno