Easy
Find oldest student
Return the oldest student in the students
table.
SCHEMA
students
+------------+------------+-----------+-----+------------+
| student_id | first_name | last_name | age | class_code |
+------------+------------+-----------+-----+------------+
| 1 | Mike | Chaplin | 12 | 7A |
| 2 | Emily | Jackson | 12 | 7A |
| 3 | Robert | Jackson | 12 | 7A |
| ... | ... | ... | ... | ... |
+------------+------------+-----------+-----+------------+
EXPECTED OUTPUT
+------------+------------+-----------+-----+------------+
| student_id | first_name | last_name | age | class_code |
+------------+------------+-----------+-----+------------+
| 47 | Usman | Jones | 19 | 8A |
+------------+------------+-----------+-----+------------+
Use ORDER BY
to sort the students by age.
Use LIMIT
to specify the number of rows you want to show. For example, appending LIMIT 5
to the end of your query will result in the first five rows being returned.
SELECT *
FROM students
ORDER BY age DESC
LIMIT 1