groupbyderived metrics

The full problem statement is available to Pro members.

preloaded fixtures

import pandas as pd

ad_auctions = pd.DataFrame({
    "campaign": ["brand-a", "brand-a", "brand-b", "brand-b", "brand-c", "brand-c"],
    "device": ["mobile", "desktop", "mobile", "desktop", "mobile", "desktop"],
    "impressions": [120000, 40000, 25000, 15000, 90000, 10000],
    "cost": [960.0, 520.0, 300.0, 240.0, 450.0, 130.0],
    "conversions": [240, 130, 40, 36, 90, 12],
})

Guest mode · solve history stays on this device; code isn’t saved. Sign in to save future work

Pro problem

“Ad auction eCPM by campaign”

This is one of the real interview questions in Pro. Try Pro free for 7 days to unlock it and everything below:

  • 293 interview-grade problems across SQL, Python & pandas
  • 104+ real-world SQL problems: SaaS retention, fintech ledgers, supply chain, recursive CTEs
  • 18 company interview packs (Amazon, Meta, Google, Uber and more)
  • AI "explain my mistake" tutor and mock interviews
  • Use QueryLab inside Claude, Cursor & other AI assistants

// built for real interview rounds

Practice the patterns 18 top companies test

329 problems · 36 free forever · 293 unlocked with Pro

Card required. Then $12/month. Cancel before your trial ends and you pay nothing.

or keep practicing free problems →

Secure checkout by Paddle · instant access · cancel anytime from your account