← Back to INSERT, UPDATE & DELETE
Question 85
A New Instructor Takes Over BUS320
A New Instructor Takes Over BUS320
Business (department 5) hires Nadia Farouk to teach Financial Accounting. FirstINSERTher intoinstructorswithfirst_name'Nadia',last_name'Farouk',nadia.farouk@school.example',department_id5,hire_date'2026-01-05',salary84000 andtitle'Assistant Professor'; leaveidout (she becomes 13) and leaveoffice,phoneandis_tenuredout so the first two are NULL and the third takes its DEFAULT of 0. ThenUPDATEcourse 12 (BUS320, the only course with a NULLinstructor_id) so itsinstructor_idis her new id. Only row 13 ofinstructorsand row 12 ofcoursesare new or changed.
Expected result:
instructors after your statements: 13 rows +----+------------+-----------+--------------------------------+---------------+------------+--------+--------+--------------+------------+---------------------+ | id | first_name | last_name | email | department_id | hire_date | salary | office | phone | is_tenured | title | +----+------------+-----------+--------------------------------+---------------+------------+--------+--------+--------------+------------+---------------------+ | 1 | Grace | Okafor | grace.okafor@school.example | 1 | 2012-08-20 | 98500 | T-210 | 416-555-0201 | 1 | Professor | | 2 | Daniel | Reyes | daniel.reyes@school.example | 1 | 2019-01-14 | 82000 | T-214 | 416-555-0202 | 0 | Assistant Professor | | 3 | Mei | Chen | mei.chen@school.example | 1 | 2016-09-01 | 88000 | T-218 | NULL | 1 | Associate Professor | | 4 | Samuel | Whitaker | samuel.whitaker@school.example | 2 | 2009-07-06 | 101000 | G-105 | 416-555-0204 | 1 | Professor | | 5 | Priya | Natarajan | priya.natarajan@school.example | 2 | 2021-08-30 | 76500 | G-112 | 416-555-0205 | 0 | Lecturer | +----+------------+-----------+--------------------------------+---------------+------------+--------+--------+--------------+------------+---------------------+ (showing 5 of 13 rows) courses after your statements: 14 rows +----+---------+-----------------------------+---------------+---------------+---------+-------+-----------+-------+-------------+-----+ | id | code | title | department_id | instructor_id | credits | level | max_seats | room | semester | fee | +----+---------+-----------------------------+---------------+---------------+---------+-------+-----------+-------+-------------+-----+ | 1 | CS101 | Introduction to Programming | 1 | 1 | 3 | 100 | 60 | T-100 | Fall 2025 | 650 | | 2 | CS201 | Data Structures | 1 | 2 | 3 | 200 | 40 | T-102 | Winter 2026 | 650 | | 3 | CS230 | Databases | 1 | 3 | 3 | 200 | 35 | T-104 | Winter 2026 | 700 | | 4 | CS310 | Operating Systems | 1 | 1 | 4 | 300 | 30 | T-106 | Fall 2025 | 820 | | 5 | MATH110 | Calculus I | 2 | 4 | 4 | 100 | 80 | G-001 | Fall 2025 | 600 | +----+---------+-----------------------------+---------------+---------------+---------+-------+-----------+-------+-------------+-----+ (showing 5 of 14 rows)
Hints4 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.