So I have 3 tables reservations, flight and airport and I need to update price from reservations based on what city it is in(the city field is in airport).
Here are my create tables to show the link between the tables:
create table airport
(airport_code varchar(100) primary key,
city varchar(100),
country varchar(100) );
create table flight
(flight_code varchar(100) primary key,
dept_airport_code varchar(100),
arr_airport_code varchar(100),
foreign key (dept_airport_code) references airport (airport_code),
foreign key (arr_airport_code) references airport (airport_code) );
create table reservation
(flight_code varchar(100),
reservation add price integer);
This is what I have tried till now, based on previous answers to similar questions and it is not working.
update reservation r inner join flight f on r.flight_code=f.flight_code
inner join airport a on f.dept_airport_code=a.airport_code
set r.price=4000 where a.city='Dubai';
It's giving me this error: ORA-00971: missing SET keyword
I think this is because Oracle doesn't accept this syntax and those answers were for MySQL.