Row fan-out after a JOIN
Row fan-out after a JOIN
You are a junior analyst at the PlayReel streaming service. The catalog lives in shows (one row per show) and seasons live in seasons: a show may have several. A teammate complained that after joining the two tables shows got duplicated and the catalog view looks bloated. You are asked to show the scale of the problem: for every show that occupies more than one row after the join, output how many rows it fans out into.
Return columns:
- title — show title;
- join_rows — how many rows this show produces after joining to seasons (integer, strictly greater than 1).
Sort by join_rows descending, then title ascending. Exclude shows that produce exactly one row or have no seasons at all.
Exemplo de resposta esperada
É assim que se parece uma resposta correta: ela tem seu próprio número de linhas e não precisa coincidir com as tabelas do esquema. Sua resposta precisa retornar os mesmos nomes de colunas do exemplo: use AS para renomeá-las se for preciso.
| title | join_rows |
|---|---|
| Silver Steppe | 4 |
| Iron Harbor | 3 |
| Paper Storm | 3 |
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
Entrar