ROUND() with a negative parameter
A useful thing you can do with ROUND()
is have a negative number as the decimal place parameter. This can come in handy if your manager only needs to know the average number of facebook_likes
to the hundreds since granularity below one hundred likes won't impact decision making.
Social media plays a significant role in determining success. If a movie trailer is posted and barely gets any likes, the movie itself may not be successful. Remember how 2020's "Sonic the Hedgehog" movie got a revamp after the public saw the trailer?
Let's apply this to other parts of the dataset and see what the benchmark is for movie budgets so, in the future, it's clear whether the film is above or below budget.
This exercise is part of the course
Intermediate SQL
Exercise instructions
- Calculate the average
budget
from thefilms
table, aliased asavg_budget_thousands
, and round to the nearest thousand.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
-- Calculate the average budget rounded to the thousands
___