Loading…
NTILE(n) divides rows into n equal buckets:
NTILE(4) OVER(ORDER BY price) -- splits into 4 quartiles
Divide products into 3 price tiers:
Order by price_tier, then price.
Downloading SQL engine… (one-time)
This runs entirely in your browser and is cached for next time.