Professional Documents
Culture Documents
How To Find (Calculate) Median Using Oracle SQL Query
How To Find (Calculate) Median Using Oracle SQL Query
How To Find (Calculate) Median Using Oracle SQL Query
Home Data Warehouse Informatica Informatica Scenarios Informatica Cloud Oracle Unix Hadoop
Search... Search
How to find (calculate) median using oracle sql query
A median is a value separating the higher half of sample from the lower half. The median can be
Popular Posts
found by arranging all the numerical values from lowest to highest value and picking the middle Informatica Scenario Based Interview Questions with
one. If there are even number of numerical values, then there is no single middle value; then the Answers - Part 1
median is defined as the mean of the two middle values.
Unix Sed Command to Delete Lines in File - 15 Examples
Now let see how to calculate the median in oracle with the employees table as example. String Functions in Hive
2, 100, 3000
Date Functions in Hive
3, 100, 4000
5, 200, 6000 Design/Implement/Create SCD Type 2 Effective Date
6, 200, 8000 Mapping in Informatica
The below query is used to calculate the median of employee salaries across the entire table. Grep Command in Unix and Linux Examples
select empid,
Have Questions? Follow Me
dept_id,
salary,
percentile_disc(0.5) within group (order by salary desc)
over () median
from employees;
https://www.folkstalk.com/2011/11/how-to-find-calculate-median-using.html 1/3
11/29/2018 How to find (calculate) median using oracle sql query
vijay bhaskar
The output of the above query is Add to circles
Now we will write a query to find the median of employee salaries in each department.
select empid,
dept_id,
994 have me in circles View all
salary,
percentile_disc(0.5) within group (order by salary desc)
over (partition by department_id) median
from employees;
Recommended Reading:
https://www.folkstalk.com/2011/11/how-to-find-calculate-median-using.html 2/3
11/29/2018 How to find (calculate) median using oracle sql query
If you like this article, then please share it or click on the google +1 button.
No comments:
Post a Comment
Publish Preview
https://www.folkstalk.com/2011/11/how-to-find-calculate-median-using.html 3/3