Question: FOR SQL USERS. For this exercise I had to calculate the the duration of the movie in minutes and needed to include the movie_id, movie_type,
FOR SQL USERS. For this exercise I had to calculate the the duration of the movie in minutes and needed to include the movie_id, movie_type, and start and end time. I also needed to show the duration in my results and sort the results from longest to shortest duration.
** Now, I will need to categorize and count the movies by duration.
I will need to use a CASE statement to count the number of movies and categorize the movies by the categories. I will use the 2 categories:
("under an hour" for movies under 60 minutes and
"at least an hour" for movies over 60 minutes.)
I will need to find total amount of the movies that were under an hour
SELECT movie_id, movie_type, DATEDIFF(minute, movie_begin_time, movie_end_time) AS movie_minutes CASE WHEN movieduration_minutes < 60 THEN 'The movie is under an hour' WHEN movieduration_minutes >= 60 THEN 'The movie is at least an hour' ELSE 'The quantity is under 30' FROM movie_data ORDER BY movieduration_minutes DESC, movie_ID;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
