Division
Compute the average revenue per employee for Fortune 500 companies by sector.
This exercise is part of the course
Exploratory Data Analysis in SQL
Exercise instructions
- Compute revenue per employee by dividing
revenuesbyemployees; casting is used here to produce a numeric result. - Take the average of revenue per employee with
avg(); alias this asavg_rev_employee. - Group by
sector. - Order by the average revenue per employee.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Select average revenue per employee by sector
SELECT ___,
___(___/___::numeric) AS avg_rev_employee
FROM fortune500
GROUP BY ___
-- Use the column alias to order the results
ORDER BY ___;