PostgreSQL - Window Functions in PostgreSQL
Given a table
Query:
employees with salaries: 3000, 4000, 5000, 6000, 7000, what is the NTILE(3) bucket for salary 6000?Query:
SELECT salary, NTILE(3) OVER (ORDER BY salary) AS bucket FROM employees;