Code Room
Code reviewMediumcr-g544
Subject Code reviewLevel Mid–Senior~18 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this SQL that powers a 'daily active users' report. created_at is a UTC timestamptz; the business reports in America/Los_Angeles.

What a strong answer looks like

Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.

Talk through your review
Code to reviewsql
SELECT  date_trunc('day', created_at) AS day,  count(DISTINCT user_id) AS dauFROM eventsWHERE created_at >= now() - interval '30 days'GROUP BY date_trunc('day', created_at)ORDER BY day;
Run or narrate your approach, then ask the coach.