Problem statement:
If the number of courses an instructor teaches is less than 1 then update the salary to 30000 else to 35000 - using one command. The code I wrote results in an error, could you please tell why it's not working and how I can improve it. Thanks in advance :D
UPDATE using oracle sql
schema:
instructor -> id, name, dept_name, salary
teaches -> id, course_id, semester, year
update i
set i.salary = case
when count(t.course_id) < 1 then 30000
else 35000
from (select * from instructor i inner join teaches t on i.id = t.id)