delete from likes;
delete from users;

\i ../etaralova415/loading.sql


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


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


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

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

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


