We are worried our cats are too fat and need to diet.
We would like to group the cats into quartiles by their weight.
Return: name, weight, weight_quartile
Order by: weight Show Table Schema
Correct output but can you use 'ntile'?
ntile() lets us divide our data into percentiles/quartiles.
If we only need to see the lowest X% this can be done via ntile() next question
select name, weight, ntile(4) over ( order by weight) as weight_quartile from cats order by weight