Top students in Cairo
Easysqlselectwhereorder by
Return name and xp for students in the city Cairo with an xp of 100 or more. Sort by xp from highest to lowest, then by name alphabetically.
Tables
- students (id INTEGER, name TEXT, city TEXT, xp INTEGER)
Example 1
students
| id | name | city | xp |
|---|---|---|---|
| 1 | Mona | Cairo | 340 |
| 2 | Omar | Giza | 500 |
| 3 | Laila | Cairo | 90 |
| 4 | Youssef | Cairo | 340 |
| 5 | Salma | Cairo | 100 |
Expected result
| name | xp |
|---|---|
| Mona | 340 |
| Youssef | 340 |
| Salma | 100 |
Constraints
- 0 ≤ rows ≤ 1000
- The order of rows matters
Submit checks your solution against 10 tests, including hidden ones.
SQL
-- Write one SELECT query. Tables: students SELECT