1. How to Select 200th to 300th records from the table
Select top 300 * from table
Except
Select top 200 * from table
2. A table records the student's score a (studentname, grade) in a certain subject. The table is sorted by score and the column "rank" is added )". How to Write a query statement?
Select a. Name, A. grade,
Rank () over (order by grade DESC) rank
From DBO. STUDENT
Dense_rank () is also available. This indicates that when there is a parallel ranking, the next ranking will only increase by 1. For example, if there are two parallel ones, the score of 2nd is 2nd, not 3rd.
3. Suppose that in question 2nd, this table records the records of all students in different courses (studentname, coursename, grade), and groups and places the records by course. The query statement can be written in this way.
Select a. Name, A. Course, A. grade,
Rank () over (partition by course order by grade DESC) rank
From DBO. STUDENT