Very Easy

Filter students by name II

Select all students in the students table whose last name is 'Jackson'. Order the results by student_id in ascending order.

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 |
+------------+------------+------------+-----+------------+
| 2          | Emily      | Jackson    | 12  | 7A         |
| 3          | Robert     | Jackson    | 12  | 7A         |
| 27         | Jim        | Jackson    | 11  | 7B         |
| ...        | ...        | ...        | ... | ...        |
+------------+------------+------------+-----+------------+

Use the WHERE keyword to apply filters to your query. For example, running a query like:

SELECT *
FROM students
WHERE student_id = 4

would return all rows in the students table where the student_id is equal to 4.

SELECT * FROM students WHERE last_name = 'Jackson' ORDER BY student_id ASC

  • This field is required.