Get startedGet started for free

Classify film lengths

You want to make browsing easier for users. You've decided to split English-language films into “Short Films” and “Long Films” depending on their duration. Movies under or equal to 90 minutes are short, while anything longer is categorized as long. Films without a known duration should be excluded.

Now it's time to categorize the films accordingly.

This exercise is part of the course

Intermediate SQL with AI

View Course

Exercise instructions

  • Write a prompt to select English films with non-null durations, classifying them as “Short Film” if 90 minutes or less, "Long Film" if over 90 minutes, otherwise "Unknown".
  • Name the new category field as film_type.
  • Display id, title, duration, and the film_type.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

SELECT 
    id, 
    title, 
    duration
FROM films;
Edit and Run Code