Row count for DISTINCT over a GROUP BY aggregate
Row count for DISTINCT over a GROUP BY aggregate
At an Avito interview they check whether the candidate understands that DISTINCT placed over the result of a grouping often changes nothing. Using the data in the events table, work out how many rows this query returns:
SELECT DISTINCT a, b, c, SUM(d) AS revenue FROM events GROUP BY a, b, c
Wrap this query and return the number of rows in a single column rows_returned.
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. Your answer must use the same column names as this sample — alias them with AS if needed.
| rows_returned |
|---|
| 11 |
Avito
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inFocus radio
Paused · SomaFM · Fluid