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.

titlejoin_rows
Silver Steppe4
Iron Harbor3
Paper Storm3
PostgreSQLv16
Entre para enviar

O resultado da sua consulta aparecerá aqui

Focus radio
Paused · SomaFM · Fluid