Questions tagged [analytic-functions]

Aggregation functions that can peek at rows returned from the same query. The SQL standard defines them as window functions and the tag `window-functions` should be preferred over `analytical-functions` unless it is something completely Oracle specific

From Oracle documentation page: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions004.htm#SQLRF06174

Analytic functions compute an aggregate value based on a group of rows. They differ from aggregate functions in that they return multiple rows for each group. The group of rows is called a window and is defined by the analytic_clause. For each row, a sliding window of rows is defined. The window determines the range of rows used to perform the calculations for the current row. Window sizes can be based on either a physical number of rows or a logical interval such as time.

Analytic functions are the last set of operations performed in a query except for the final ORDER BY clause. All joins and all WHERE, GROUP BY, and HAVING clauses are completed before the analytic functions are processed. Therefore, analytic functions can appear only in the select list or ORDER BY clause.

Analytic functions are commonly used to compute cumulative, moving, centered, and reporting aggregates.

244 questions
-2
votes
1 answer

I want to generate marksheet containing percentage, rank standard wise and division wise in oracle database

Here is my column create table exam_details( Stud_id varchar2(50), Stud_course_id Number, Stud_div char, Stud_Sub_id Number, Stud_Marks Number, Sub_total_Marks Number, Exam_id Number, …
-2
votes
1 answer

How to best calculate n-level aggregation data based on (n-1)-level data (Oracle)

In this answer (with all executable simplified and documented sample code + helpful comments) I did a kind of a trick there to calculate the last two rows of the following table: DESCR SUM …
Andreas Covidiot
  • 4,286
  • 5
  • 51
  • 96
-2
votes
1 answer

How do i prepare my data for future statistical programs?

I am currently designing a Survey system (where a Survey has many questions, a question has many answers, and a Response belongs_to a user, survey, question and answer). I will have a lot of demographic data in the User model and expect 100's of…
Kamilski81
  • 14,409
  • 33
  • 108
  • 161
-4
votes
1 answer

What is the average salary of the employees who have the highest commission

I am trying to do this question and need some hints, I want to do it with the analytic function in oracle sql. What is the average salary of the employees who have the highest commission
1 2 3
16
17