Very Easy

Select specific columns I

Select the first_name and last_name columns from the students table.

TABLES

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
+------------+-----------+
| first_name | last_name |
+------------+-----------+
| Mike       | Chaplin   |
| Emily      | Jackson   |
| Robert     | Jackson   |
| ...        | ...       |
+------------+-----------+

To select specific columns from a table, you need to state each column's name in the SELECT statement. For example, if you wanted to select only the columns col1 and col2 from a table table1, you'd write:

SELECT
  col1, 
  col2
FROM table1

SELECT first_name, last_name FROM students

  • This field is required.