Cumulative Average or Running Average in SQL

Query to obtain cumulative average or running average from employee table for salary column.

     select Employee_id, Salary,
     AVG(Salary) OVER (ORDER BY Employee_id) 
     As RunningAverage
     from employee;

Facebook Comments

Leave a Reply

Your email address will not be published. Required fields are marked *