Using Window Clause
This SQL function can be made simpler by using the WINDOW statement. Please try and use the WINDOW clause.
Each cat would like to see what half, third and quartile they are in for their weight.
Return: name, weight, by_half, thirds, quartile
Order by: weight Show Table Schema
Correct output but can you use 'window'?
Use of Window can simplify some of our complex queries
select name, weight, ntile(2) over ntile_window as by_half, ntile(3) over ntile_window as thirds, ntile(4) over ntile_window as quart from cats window ntile_window AS ( ORDER BY weight) order by weight, name