User Tools

Site Tools


kurs:partition_rank

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

kurs:partition_rank [2014/09/10 21:22] (current)
Line 1: Line 1:
 +<​code>​ 
 +select first_name,  
 +       ​last_name,​ 
 +       ​department_name,​ 
 +       ​salary,​ 
 +       ​dep_avg_sal 
 +       from ( 
 +select department_id,​ 
 +       ​first_name,​ 
 +       ​last_name,​ 
 +       ​salary, ​       
 +       ​round( avg(salary) 
 +         over (partition by department_id) ) dep_avg_sal 
 +  from employees  
 +) e join departments d 
 +on e.department_id = d.department_id 
 +where salary > dep_avg_sal 
 +</​code>​
kurs/partition_rank.txt · Last modified: 2014/09/10 21:22 (external edit)