· 6 years ago · Jan 09, 2020, 09:56 PM
1SELECT title FROM movies.movieplots WHERE releaseyear = 1952 LIMIT 15
2drop table movies. synonyms
3insert into movies.synonyms (word, synonym, score) values (knife, stab, 91338)
4create table if not exists movies.synonyms (word string, synonym string, score int)
5SELECT title FROM movies.movieplots WHERE releaseyear = 1952 LIMIT 5
6SELECT title FROM movies.movieplots WHERE releaseyear = 1952
7SELECT title FROM movies.movieplots WHERE year = 1952
8select release_year,title from movies.movieplots where plot Like 'sknife’s' and releaseyear is not null order by releaseyear
9select releaseyear,title from movies.movieplots where plot Like 'sknife’s' order by releaseyear
10select release_year.tile from movies.movieplots where plot Like 'Sknife’' order by releaseyear
11select release_year,tile from movies.movieplots where plot Like %knifes order by release_year
12select * from movies.movieplots
13create external table if not exists movies.movieplots (releaseyear int,title string,origin string,director string,actors string,genre string,wiki_page string,plot string) row format delimited fields termirated by ',' stored as textfile
14location ‘hdfs://quickstart.cloudera:8022/user/hadoop/HDFS/rawdata/movie_plots'
15create external table if not exists movies.movieplots (releaseyear int, title string,origin string,director string,actors string,genre string,wiki_page string,plot string) row format delimited fields termirated by ',' stored as textfile
16location ‘hdfs://sandbox.hortonworks .com:8020/user/hadoop/HDFS/raw_data/movieplots’
17create external table if not exists movies.movieplots (releaseyear int,title string,origin string,director string,actors string,genre string,wiki_page string,plot string) row format delimited fields termirated by ',' stored as textfile
18location ‘hdfs://user/hadoop/HOFS/raw_data/movieplots’
19create schema if not exists movies
20use movies
21create database movies
22
23
24=============================
25
26
271.
28-zlicz wszystkie filmy z roku XXXX
29-weź obsadę każdego filmu z XXXX
30 -split nazwisk (","?), tak żeby było po jednym
31 -jeśli nazwisko mapuje się do kobiety z actors_genders: Females++, Films_with_women.append(tenFilm)
32-oblicz odsetek = Females/Wszystkie_Filmy_z_XXXX
33-zapisz FilmsWithWomen
34-zapisz odsetek
35
362.
37-zlicz wszystkie filmy które dostaly oscara w roku XXXX
38-szukaj FilmsWithWomen przez query w bazie oscars
39 -jeśli znaleziony: oscars_for_women_films++, women_films_oscars.append()
40-oblicz odsetek = oscars_for_women_films/WszystkieOscaryXXX
41-zapisz women_films_oscars
42-zapisz odsetek