Row count for DISTINCT over a GROUP BY aggregate
Avito asks a classic interview gotcha: does the candidate know that DISTINCT on top of GROUP BY is almost always a no-op? Here is a tiny repro of the same trick on click-analytics data.
Run the query against the seed data and return how many rows it produces:
Return the result in a single column rows_returned — the count of rows the query above yields on the seed data (i.e. wrap the query and COUNT(*) over it).
Expected output sample
This is what a correct answer looks like — its row count is its own, it doesn't have to match the schema tables.
| rows_returned |
|---|
| 11 |
Avito
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid