delete from likes;
delete from users;

drop table if exists movies cascade;
\i /usr0/stu415_s13/etaralova415/loading.sql

insert into users (login_id,email,passwd) values ('anca', 'anca@cmu.edu', 'ancapass');
insert into users (login_id,email,passwd) values ('bob', 'bob@cmu.edu', 'bobpass');
insert into users (login_id,email,passwd) values ('charlie', 'charlie@cmu.edu', 'charliepass');

insert into users (login_id,email,passwd) values ('david', 'david@cmu.edu', 'davidpass');

insert into likes (login_id,mtitle) values ('anca', 'Armageddon');
insert into likes (login_id,mtitle) values ('bob', 'Armageddon');
insert into likes (login_id,mtitle) values ('bob', 'TRON');
insert into likes (login_id,mtitle) values ('bob', 'Batman');
insert into likes (login_id,mtitle) values ('charlie', 'Armageddon');
insert into likes (login_id,mtitle) values ('charlie', 'TRON');
insert into likes (login_id,mtitle) values ('charlie', 'Bolt');
insert into likes (login_id,mtitle) values ('charlie', 'Casino');


drop view  if exists nonexst cascade;
drop view  if exists all_comb cascade;
drop view  if exists all_charlie cascade;
drop view  if exists liked cascade;


create view liked as select mtitle from (select mtitle from likes where login_id='charlie') as charlie_liked;
create view all_charlie as select distinct(login_id) from likes where login_id='charlie';
create view all_comb as select * from all_charlie, movies;
create view nonexst as select * from all_comb except (select login_id, mtitle from likes);

select count(*) from likes;
select mtitle from nonexst;




