--- title: MySQL 語法 tags: SQL --- * 排序 1. ROW_NUMBER() = INDEX ( 1 2 3 4 5 6 ) ``` ROW_NUMBER() OVER ( ORDER BY number ) as 'index' ``` 2. RANK() = 非連續排名 ( 重複名次時會跳過下一名 ex: 1 1 3 4 4 6 ) ``` RANK() OVER ( ORDER BY score ) as 'rank' ``` 3. DENSE_RANK() = 連續重複排名 ( ex: 1 1 2 3 4 5 ) ``` DENSE_RANK() OVER ( ORDER BY score ) as 'dense_rank'
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up