I have 3 tables. cinema, booking and customer
create table cinema
(
c_id int,
location varchar(10)
)
insert into cinema values(1,'New York');
insert into cinema values(2,'London');
insert into cinema values(3,'Paris');
create table booking
(
c_id int,
cust_id int
)
insert into booking values(1,10);
insert into booking values(2,11);
insert into booking values(3,12);
insert into booking values(3,13);
insert into booking values(2,14);
create table customer
(
cust_id int,
cust_name varchar(10)
)
insert into customer values(10,'sam');
insert into customer values(11,'adrian');
insert into customer values(12,'mark');
insert into customer values(13,'jim');
insert into customer values(14,'tom');
I want to select customer id(ie; cust_id), customer name(cust_name) and location(from cinema table) of all customer who have not booked in paris.
what i want is --
cust_id cust_name location
10 sam New York
11 adrian London
14 tom London
I tried a lot.... one of my code is ---
SELECT customer.cust_id,customer.cust_name,
cinema.location as Location FROM booking,cinema,customer
WHERE booking.c_id=cinema.c_id AND location!='Paris';
it gives me 15 result.. I cant think how to do this.. please help me with this.