Daily Creators And Generations Per Creator By Model
Last updated: November 29, 2026
Quick Overview
Using a generations table (generation_id, user_id, model, status, created_at), write SQL returning for each day and model the number of distinct creators, total successful generations and successful generations per creator.
Luma AI
November 29, 20260
0
0 solved
Using a generations table (generation_id, user_id, model, status, created_at), write SQL returning for each day and model the number of distinct creators, total successful generations and successful generations per creator.
When a new Ray model version launches next to an older one, the team watches whether creators adopt it and how intensively they use it. The interviewer looks for correct handling of failed jobs, distinct counts and safe division.
What the Interviewer Expects
- Ask what counts as a creator (any attempt or a success)
- Filter or conditionally count on status
- Truncate timestamps to a date in one time zone
- Use COUNT DISTINCT correctly
- Guard the ratio against division by zero
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you get a 7-day rolling count of distinct creators per model?
- How would you attribute a user who used both models on the same day?
- What would make generations per creator misleading as a success metric?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
generations(generation_id, user_id, model, status, created_at), status in ('succeeded', 'failed', 'moderated', 'cancelled'). I will define a creator as a user with at least one successful generation...
Approach
Group by UTC date and model. Count distinct users among succeeded rows, count succeeded rows, and divide with NULLIF so a day with no successes returns NULL instead of erroring. I keep the conditional...