Starting from a topic
Which of the following sort function will form a "1,2,2,4,5,5,7" sort of result?
-
Rank()
-
DENSE_RANK()
-
ROW_NUMBER()
-
All error
Resolution:
1.row_number
ROW_NUMBER number will not be repeated continuously during the ranking, also encountered even when two tables 3
perform
SELECT ROW_NUMBER () the OVER (Order by e.salary desc) AS row_num, e.salary
from Employee E
in FIG Results
2.rank
Rank ordering requirements will function the same value as grouped and each number, sort does not continuously
execute
() the OVER (Order by e.salary desc) aS SELECT row_num Rank, e.salary
from Employee E
result:
3.dense_rank
DENSE_RANK sort is continuous, the same value will be divided into a number of different sorting groups each
perform
SELECT DENSE_RANK () the OVER (Order by e.salary desc) AS row_num, e.salary
from Employee E
Results:
This question is so selected DENSE_RANK ()