← Back to INSERT, UPDATE & DELETE
Question 81
Graduate the Long-Standing Students
Graduate the Long-Standing Students
Everyone who joined in 2022 or earlier and is stillactivehas finished their degree: set theirstatusto 'graduated'. Eight rows change (ids 2, 9, 12, 14, 19, 22, 25 and 26) and nobody else does: Ethan Walsh (id 6, class of 2022) ison_leave, not active, so he keeps that status, and the three students who already graduated are unaffected either way.
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 | graduated | 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 | NULL | 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
Sign in to use hintsTopics:
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.