Very Easy

First 2 rows

Consider the following table students, which contains information about the students in a local high school.

+------------+------------+-----------+-----+------------+
| student_id | first_name | last_name | age | class_code |
+------------+------------+-----------+-----+------------+
| 1          | Mike       | Chaplin   | 12  | 7A         |
| 2          | Emily      | Jackson   | 12  | 7A         |
| 3          | Robert     | Jackson   | 12  | 7A         |
| ...        | ...        | ...       | ... | ...        |
+------------+------------+-----------+-----+------------+

Write a query that returns the first 2 rows of this table.

EXPECTED OUTPUT
+------------+------------+-----------+-----+------------+
| student_id | first_name | last_name | age | class_code |
+------------+------------+-----------+-----+------------+
| 1          | Mike       | Chaplin   | 12  | 7A         |
| 2          | Emily      | Jackson   | 12  | 7A         |
+------------+------------+-----------+-----+------------+

Use LIMIT to specify the number of rows you want to show. For example, while the following code will result in all the rows in the table being returned...

SELECT * FROM table1

... appending LIMIT 5 to the end of your query will result in the first five rows being returned:

SELECT * FROM table1 LIMIT 5

SELECT * FROM students LIMIT 2

  • This field is required.