Split the books into 4 price quartiles with NTILE. Columns: title, price, quartile. Order by price.
Split the books into 4 price quartiles with NTILE. Columns: title, price, quartile. Order by price.
Answer
SELECT title, price, ntile(4) OVER (ORDER BY price) AS quartile FROM books ORDER BY price;