Filmlar
Tomoshabin
Reyting
Reyting jadvalida filmlar nechtadan ovozga ekanligini aniqlash.
select film_id, count(*) from reyting group by film_id order by count(*);
Reyting jadvalida filmlar to’plagan ballar va uni kamayish taribida aniqlash.
select film_id, sum(ball) from reyting group by film_id order by sum(ball) desc ;
Reyting va Filmlar jadvallarini bog’lagan holda filmlar to’plagan ballar va uni kamayish taribida aniqlash.
select film_nomi, sum(ball) from reyting inner join filmlar on reyting.film_id=filmlar.id group by film_id order by sum(ball) desc;
create table Filmlar (
id INT,
Film_nomi VARCHAR(50),
Yil INT,
Janr VARCHAR(50)
);
insert into Filmlar (id, Film_nomi, Yil, Janr) values (1, 'Idiots, The (Idioterne)', 2023, 'Comedy|Drama');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (2, 'Copycat', 2023, 'Crime|Drama|Horror|Mystery|Thriller');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (3, 'Fata Morgana', 2023, 'Documentary|Drama|SciFi');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (4, 'Green Pastures, The', 2022, 'Drama');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (5, 'Safe Men', 2023, 'Comedy');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (6, 'Happy Weekend', 2022, 'Comedy');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (7, 'Queen - Rock Montreal', 2023, ' Thriller'');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (8, 'Ball, The (Le bal)', 2023, 'Musical');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (9, 'Cursed', 2022, 'Horror|Thriller');
insert into Filmlar (id, Film_nomi, Yil, Janr) values (10, 'Man Who Planted Trees'')', 2022, 'Animation|Drama');
create table tomoshabin (
id INT,
FISH VARCHAR(50),
E_mail VARCHAR(50)
);
insert into tomoshabin (id, FISH, E_mail) values (1, 'Dominik Goldthorp', 'dgoldthorp0@sphinn.com');
insert into tomoshabin (id, FISH, E_mail) values (2, 'Ozzy Gonnel', 'ogonnel1@cbc.ca');
insert into tomoshabin (id, FISH, E_mail) values (3, 'Rorke Middell', 'rmiddell2@trellian.com');
insert into tomoshabin (id, FISH, E_mail) values (4, 'Ignace Fenemore', 'ifenemore3@elpais.com');
insert into tomoshabin (id, FISH, E_mail) values (5, 'Veriee Edlin', 'vedlin4@nba.com');
insert into tomoshabin (id, FISH, E_mail) values (6, 'Bernadina Parrott', 'bparrott5@livejournal.com');
insert into tomoshabin (id, FISH, E_mail) values (7, 'Roderic Bluck', 'rbluck6@xing.com');
insert into tomoshabin (id, FISH, E_mail) values (8, 'Eugen Linfoot', 'elinfoot7@google.com.au');
insert into tomoshabin (id, FISH, E_mail) values (9, 'Carlie Lovell', 'clovell8@oaic.gov.au');
insert into tomoshabin (id, FISH, E_mail) values (10, 'Damara Rosenvasser', 'drosenvasser9@hibu.com');
insert into tomoshabin (id, FISH, E_mail) values (11, 'Pauline MacIlwrick', 'pmacilwricka@springer.com');
insert into tomoshabin (id, FISH, E_mail) values (12, 'Lorianne Fancourt', 'lfancourtb@symantec.com');
insert into tomoshabin (id, FISH, E_mail) values (13, 'Alexio Alan', 'aalanc@hexun.com');
insert into tomoshabin (id, FISH, E_mail) values (14, 'Fanny Raymont', 'fraymontd@4shared.com');
insert into tomoshabin (id, FISH, E_mail) values (15, 'Ambur Andryunin', 'aandryunine@dion.ne.jp');
insert into tomoshabin (id, FISH, E_mail) values (16, 'Montgomery Blint', 'mblintf@noaa.gov');
insert into tomoshabin (id, FISH, E_mail) values (17, 'Harwilll Rubens', 'hrubensg@imageshack.us');
insert into tomoshabin (id, FISH, E_mail) values (18, 'Philbert Oakinfold', 'poakinfoldh@yahoo.co.jp');
insert into tomoshabin (id, FISH, E_mail) values (19, 'Gloriane Petrelli', 'gpetrellii@phoca.cz');
insert into tomoshabin (id, FISH, E_mail) values (20, 'Ebenezer Francey', 'efranceyj@businessweek.com');
create table reyting (
film_id INT,
tomoshabin_id INT,
ball INT
);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 7, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 14, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 18, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (5, 12, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 4, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 1, 2);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 14, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (6, 10, 2);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 6, 2);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 10, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 10, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 20, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 11, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 18, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 1, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 16, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (6, 19, 2);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 14, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 11, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 14, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 2, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 7, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 12, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 9, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 6, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (5, 2, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 10, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 9, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 14, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (5, 5, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 7, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 18, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 4, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 9, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 3, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 11, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 1, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 12, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 17, 2);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 6, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 20, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 8, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 13, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (6, 6, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 4, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 16, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 3, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 11, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 16, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 8, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 8, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (6, 1, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 3, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 16, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (6, 3, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 4, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 16, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 19, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 9, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 12, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 20, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 11, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 12, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 8, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 11, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 19, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 2, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 19, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 9, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (5, 7, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (6, 17, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 3, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 9, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 13, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 6, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (5, 11, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (5, 2, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 1, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 3, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 4, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 20, 4);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 10, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 19, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 10, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (2, 20, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (7, 18, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 8, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 1, 10);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 4, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 6, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (4, 15, 2);
insert into reyting (film_id, tomoshabin_id, ball) values (9, 18, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 7, 9);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 1, 8);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 8, 7);
insert into reyting (film_id, tomoshabin_id, ball) values (1, 19, 1);
insert into reyting (film_id, tomoshabin_id, ball) values (8, 5, 5);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 14, 3);
insert into reyting (film_id, tomoshabin_id, ball) values (10, 8, 6);
insert into reyting (film_id, tomoshabin_id, ball) values (3, 14, 3);
Do'stlaringiz bilan baham: |