Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
SQL Server 119
#SQLServer 88
Oracle 70
#SQL SERVER 35
BRH 31
SQL Server 2012 29
denali 23
#TSQL 19
TSQL 19
C# 15

Archive · View All
October 2011 31
November 2011 30
September 2011 30
August 2011 18
December 2011 15
July 2011 13
June 2011 8
May 2012 4
April 2012 3
January 2010 3

Day 40: Ratio_To_Report Function of Oracle

Oct 23 2011 11:02PM by Niladri Biswas   

Let Us Learn Oracle - Part 40 of N [ Ratio_To_Report function of Oracle ]

Purpose: It is a analytic function that computes the ratio of a value to the sum of a set of values

Formula:

Ratio_To_Report = (Individual Value)/(Sum of Set of Values)

Example

SQL> Select EmpName,Salary,Ratio_to_Report(SALARY) Over() As RatioReportExample
  2  From tblEmployee
  3  Where DeptId = 1;

EMPNAME                                                SALARY RATIOREPORTEXAMPLE
-------------------------------------------------- ---------- ------------------
Deepak Kumar Goyal                                       6000         .146305779
Amitav Mallik                                           16000         .390148744
Deepak Singh                                             6890         .168007803
Shashi Bhushan                                           5120         .124847598
Amitav Salonki                                           7000         .170690076

Now let us see how the values are calculated

Let us first find the sum of the salary of the Employees that belongs to Department = 1

SQL>  SElect Sum(SALARY)
  2   From tblEmployee
  3  Where DeptId = 1;

SUM(SALARY)
-----------
      41010

And we want to find the Ratio_To_Report for the first employee i.e. "Deepak Kumar Goyal".

So at this stage we have,

Individual Value = 6000 and Sum of Set of Values = 41010

So put the values in the formula

Ratio_To_Report = 6000/41010 = .146305779

Let us do it for the third employee "Deepak Singh"

Ratio_To_Report = 6890/41010 = .168007803

Hope we understand how it works.Thanks for reading

Tags: SQL Server, Oracle, #SQL SERVER,


Niladri Biswas
7 · 21% · 6710
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Day 40: Ratio_To_Report Function of Oracle" rated 5 out of 5 by 1 readers
Day 40: Ratio_To_Report Function of Oracle , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]