Skip to content
SQL interview questions

StreamFlix

Video streaming

StreamFlix is a subscription video streaming service with movies, series and originals, available in six countries. It records sign-ups, plan subscriptions, monthly payments, every viewing session and what the recommendation engine showed each user. That makes it a good playground for the engagement, retention, churn and content-performance questions asked in product and data analyst interviews at streaming and media companies.

See the StreamFlix tables

StreamFlix schema

All tables live in the streamflix schema, so write streamflix.users in your queries.

streamflix.users

One row per registered account.

  • user_id (INT) — PK
  • email (VARCHAR(120))
  • full_name (VARCHAR(80))
  • country (VARCHAR(40))
  • signup_date (DATE)
  • device_type (VARCHAR(20)) — device used at signup: 'mobile', 'tv', 'web', 'tablet'
  • status (VARCHAR(20)) — 'ACTIVE' (has an active subscription), 'CANCELLED' (had one, none now), 'REGISTERED' (never subscribed)

streamflix.plans

The plans on sale and their current monthly price (USD).

  • plan_type (VARCHAR(20)) — PK; 'Basic', 'Standard', 'Premium'
  • monthly_price (DECIMAL(6,2))
  • max_screens (INT)
  • video_quality (VARCHAR(10))

streamflix.subscriptions

One row per subscription period. Changing plan ends one row and starts a new one.

  • subscription_id (INT) — PK
  • user_id (INT) — FK → users.user_id
  • plan_type (VARCHAR(20)) — FK → plans.plan_type
  • start_date (DATE)
  • end_date (DATE) — nullable; NULL while the subscription is running
  • status (VARCHAR(20)) — 'active', 'cancelled', 'switched_plan'
  • auto_renew (BOOLEAN)
  • monthly_price (DECIMAL(6,2)) — price the user pays on this subscription

streamflix.payments

Monthly billing attempts (USD).

  • payment_id (INT) — PK
  • user_id (INT) — FK → users.user_id
  • subscription_id (INT) — FK → subscriptions.subscription_id
  • amount (DECIMAL(6,2))
  • payment_date (DATE)
  • status (VARCHAR(10)) — 'SUCCESS', 'FAILED', 'REFUNDED'

streamflix.content

The catalogue: one row per movie or series.

  • content_id (INT) — PK
  • title (VARCHAR(120))
  • content_type (VARCHAR(10)) — 'movie' or 'series'
  • genre (VARCHAR(30))
  • release_year (INT)
  • maturity_rating (VARCHAR(5)) — 'U', '13+', '16+', '18+'
  • duration_minutes (INT) — nullable; runtime for movies; NULL for series (see episodes)
  • is_original (BOOLEAN) — produced by StreamFlix
  • avg_rating (DECIMAL(2,1)) — rating shown in the app, 1 to 5
  • added_at (DATE) — date it became available

streamflix.episodes

Episodes of series.

  • episode_id (INT) — PK
  • content_id (INT) — FK → content.content_id
  • season_number (INT)
  • episode_number (INT)
  • title (VARCHAR(140))
  • duration_minutes (INT)

streamflix.watch_history

One row per viewing session.

  • watch_id (INT) — PK
  • user_id (INT) — FK → users.user_id
  • content_id (INT) — FK → content.content_id
  • episode_id (INT) — FK → episodes.episode_id; nullable; set for series; NULL for movies
  • watched_at (TIMESTAMP) — session start
  • watch_duration_minutes (INT)
  • device_type (VARCHAR(20))
  • completed (BOOLEAN) — watched at least 90% of the movie or episode

streamflix.ratings

Star ratings users give titles.

  • rating_id (INT) — PK
  • user_id (INT) — FK → users.user_id
  • content_id (INT) — FK → content.content_id
  • rating (INT) — 1 to 5
  • rated_at (DATE)

streamflix.recommendations

Titles the recommendation engine showed to a user.

  • recommendation_id (INT) — PK
  • user_id (INT) — FK → users.user_id
  • content_id (INT) — FK → content.content_id
  • shown_at (TIMESTAMP)
  • placement (VARCHAR(30)) — 'home_row', 'because_you_watched', 'trending'

Beginner (12)

  • BeginnerThe first 10 users to sign upOpen now
  • BeginnerUsers by countryOpen now
  • BeginnerActive Premium subscribers in India
  • BeginnerGenres in the catalogue
  • BeginnerMovies released last year
  • BeginnerTop 5 highest-rated titles
  • BeginnerMovies longer than 150 minutes
  • BeginnerMovies vs series, and originals
  • BeginnerActive subscriptions by plan
  • BeginnerSign-ups in the last 30 days
  • BeginnerSearch titles for 'love'
  • BeginnerFailed payments in the last 30 days

Intermediate (15)

  • IntermediateMonthly watch hours and hours per viewer
  • IntermediateCompletion rate by movie
  • IntermediateTop 10 titles by viewers
  • IntermediateUsers without an active subscription
  • IntermediateMonthly recurring revenue by plan
  • IntermediateMonthly active users (MAU)
  • IntermediateMost-watched genre in each country
  • IntermediateAverage session length by day of week
  • IntermediateBinge-watching days
  • IntermediateRecommendation conversion within 7 days
  • IntermediateDisplayed rating vs user ratings
  • IntermediatePeak viewing hours
  • IntermediatePayment failure rate by country
  • IntermediateSeasons and episodes per series
  • IntermediateGenre title lists excluding unavailable durations

Advanced (26)

  • AdvancedPlan upgrades and downgrades
  • AdvancedMonthly subscriber churn rate
  • AdvancedViewing retention by signup cohort
  • AdvancedWhich titles make up 80% of watch time?
  • AdvancedSeason 1 episode drop-off
  • AdvancedEngagement segments for active subscribers
  • AdvancedLongest daily watching streak
  • AdvancedPeak concurrent viewers (last 7 days)
  • AdvancedWhat people watch next
  • AdvancedDaily active users with a 7-day average
  • AdvancedWho finished season 1?
  • AdvancedARPU by country last month
  • AdvancedFailed payment recovery rate
  • AdvancedRecommended vs organic sessions
  • AdvancedRolling seven-calendar-day unique viewers
  • AdvancedViewer streaks across consecutive active months
  • AdvancedDetect overlapping subscription intervals
  • AdvancedViewing sessions separated by inactivity
  • AdvancedLatest unconsumed recommendation per user
  • AdvancedMissing season-one episodes using relational division
  • AdvancedNULL-safe unwatched episode anti-join
  • AdvancedReverse-chronological ratings keyset page
  • AdvancedParse a typed JSON batch of catalogue IDs
  • AdvancedDelete older duplicate current ratings safely
  • AdvancedInspect watch-history foreign-key dependencies
  • AdvancedA trigger that rejects out-of-range rating writes

Mock interview round (5)

  • AdvancedMock round 1: MRR today vs 90 days ago
  • AdvancedMock round 2: Subscribers at risk of cancelling
  • AdvancedMock round 3: Share of watch time from originals
  • AdvancedMock round 4: Weekly active users trend
  • AdvancedMock round 5: New titles nobody is watching

Choose optional cookies

We use necessary cookies for account security. With your permission, we also use analytics and advertising cookies on marketing pages. See our Privacy Policy.