``` select p, s, dense_rank() over (order by p), row_number() over (partition by p) from t order by p, s; ```