AnalystPath

Listening Mix by Membership Tier

SQLMediumMid level~15 min

Problem

A media app logs how long each member spends in two modes. Table `Plays` has one row per session: `play_id`, `member_id`, `mode` (either `audio` or `video`), and `minutes` spent (decimal). Table `Members` maps each `member_id` to a membership `tier` (such as `Basic` or `Premium`).

For each membership tier, compute what percentage of the tier's total minutes was spent in `audio` mode and what percentage in `video` mode. Round both percentages to two decimal places.

Return `tier`, `audio_pct`, and `video_pct`. Order is not important.

Tables

Example rows — the live problem includes the full dataset.

Plays
play_idmember_idmodeminutes
7274123video4.5
2425123audio3.5
1413456audio5.67
Members
member_idtier
123Gold
789Silver
456Bronze

Expected output

Your answer should return 3 rows with the columns tier, audio_pct, video_pct.

Starter code (SQL)

SELECT *
FROM Plays;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions