Skip to content

2308. Arrange Table by Gender 👍

1
2
3
4
5
6
7
8
9
SELECT
  user_id,
  gender
FROM Genders
ORDER BY RANK() OVER(
    PARTITION by gender
    ORDER BY user_id
  ),
  LENGTH(gender) DESC;