From the course: Intermediate SQL: Data Reporting and Analysis
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Challenge: Report average cost by staff - SQL Tutorial
From the course: Intermediate SQL: Data Reporting and Analysis
Challenge: Report average cost by staff
(upbeat music) - [Instructor] Imagine you work in the movie rental head office doing payment analysis and you want to know if there is any difference between staff members in the average cost of the movies they've rented out in 2006. You're going to look at the payment and staff tables and compare the average cost of the amount column by staff member. You should limit yourself to 2006, reporting two columns, one containing the full name from the staff table and the other containing the average amount from the payment table. You should only be reporting two rows because there are only two staff members. You should be using a number function, date function, and a string function in this query. You may find it easiest to use table aliases. This should take you no more than five minutes. Good luck.
Contents
-
-
-
-
The basic SELECT query1m 57s
-
(Locked)
Aggregated results with GROUP BY1m 51s
-
(Locked)
Wildcards and aliases6m
-
(Locked)
Merging tables with JOIN3m 56s
-
(Locked)
Use string functions8m 6s
-
(Locked)
Use number functions with grouped data6m 46s
-
(Locked)
Use date functions6m 7s
-
(Locked)
Challenge: Report average cost by staff53s
-
(Locked)
Solution: Report average cost by staff1m 49s
-
-
-
-
-