Interview Question

Data Operations Manager Interview

-New York, NY


How do you get from Ad Impressions Clicks A 1000 10 B 2000 20 C 3000 30 D 4000 40 to Ad Clicks Impressions A Yes 10 A No 990 B Yes 20 B No 1980 C Yes 30 C No 2970 D Yes 40 D No 3960


Interview Answer

1 Answer


Within the interview I understood CASE was needed but stumbled on the UNION. I followed up post-interview but that didn't cut it I guess. SELECT a.Ad, (CASE WHEN a.clicks > 0 THEN 'Yes' ELSE 'No' END) AS 'Clicks'a.clicks AS 'Impressions' FROM PulsePoint_Q a UNION ALL SELECT b.Ad, (CASE WHEN (b.impressions - b.clicks) = 0 THEN 'Yes' ELSE 'No' END) AS 'Clicks', (b.impressions - b.clicks) AS 'Impressions' FROM PulsePoint_Q b ORDER BY Ad, Impressions ASC;

Anonymous on

Add Answers or Comments

To comment on this, Sign In or Sign Up.