-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent Rank
More file actions
31 lines (25 loc) · 756 Bytes
/
Student Rank
File metadata and controls
31 lines (25 loc) · 756 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
A university stores students' standardized test scores in a table named STUDENT. Student X placed 213th on the test.
Write a query to find Student X's test score (i.e., the 213th highest STUDENT.SCORE in STUDENT).
Schema
A table is provided: STUDENT.
STUDENT
Name Type Description
ID Integer The student's unique ID. This is a primary key.
AGE Integer The student's age.
SCORE Integer The student's standardized test score.
Sample Data Tables
STUDENT
ID AGE SCORE
1 19 91
2 20 90
3 20 87
4 21 72
5 19 98
6 20 50
The table's scores (from highest to lowest) are {98, 91, 90, 87, 72, 50}. As an example, the fourth-highest score is 87. For the real query,
find the 213th highest score.
//CODE
SELECT score
FROM student
ORDER BY score DESC
LIMIT 212, 1