CJCoding With Joseph
15free / daySign inCreate account

Noah Declares a Major

Noah Kim (student id 4) has had no declared major until now. Update his row so major_department_id is 2 (Mathematics). No other row may change, so the WHERE has to pin down exactly one student.

Expected result:

students after your statements: 30 rows
+----+------------+-----------+--------------------------------+---------------------+-----------------+------+-------------+------------+-----------+--------------------+
| id | first_name | last_name | email                          | major_department_id | enrollment_year |  gpa | city        | birth_date | status    | scholarship_amount |
+----+------------+-----------+--------------------------------+---------------------+-----------------+------+-------------+------------+-----------+--------------------+
|  1 | Ava        | Patel     | ava.patel@student.example      |                   1 |            2023 |  3.8 | Toronto     | 2005-03-14 | active    |               2500 |
|  2 | Liam       | Nguyen    | liam.nguyen@student.example    |                   1 |            2022 | 3.45 | Mississauga | 2004-11-02 | active    |               NULL |
|  3 | Sophia     | Rossi     | sophia.rossi@student.example   |                   2 |            2023 | 3.92 | Ottawa      | 2005-07-21 | active    |               5000 |
|  4 | Noah       | Kim       | noah.kim@student.example       |                   2 |            2024 | 2.95 | Toronto     | 2006-01-09 | active    |               NULL |
|  5 | Isabella   | Okoro     | isabella.okoro@student.example |                   4 |            2021 |  3.1 | Hamilton    | 2003-05-30 | graduated |                  0 |
+----+------------+-----------+--------------------------------+---------------------+-----------------+------+-------------+------------+-----------+--------------------+
(showing 5 of 30 rows)
Hints3 available
Topics:
INSERT, UPDATE & DELETE
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)

Results

Run your SQL to see every statement's output here, then how it compares with the expected answer.

Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.