SQL · Meta · Medium
Assume the SQL environment supports DATE_TRUNC('week', date) and standard date arithmetic such as subtracting two dates to obtain a day difference. You are given four relational tables from a sales CRM: accounts(account_id, industry, size_bucket, region) reps(rep_id, hire_date, segment, region, quota_usd) deals(deal_id, account_id, rep_id, created_at, closed_at, stage, is_won, amount_usd, region) touches(touch_id, account_id, rep_id, touch_date, channel, is_primary_contact)…
Checking your access…