-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRedshift_Queries.sql
39 lines (31 loc) · 930 Bytes
/
Redshift_Queries.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Create schema movies;
CREATE TABLE movies.imdb_movies_rating (
Poster_link VARCHAR(MAX),
Series_Title VARCHAR(MAX),
Released_year VARCHAR(10),
Certificate VARCHAR(50),
Runtime Varchar(50),
Genre VARCHAR(200),
IMDB_Rating DECIMAL(10,2),
Overview VARCHAR(MAX),
Meta_score INT,
Director VARCHAR(200),
Star1 VARCHAR(200),
Star2 VARCHAR(200),
Star3 VARCHAR(200),
Star4 VARCHAR(200),
No_of_Votes INT,
Gross VARCHAR(20)
);
drop table movies.imdb_movies_rating;
select * from movies.imdb_movies_rating limit 5;
select * from stl_load_errors;
CREATE MATERIALIZED VIEW movies.year_aggregated AS
SELECT released_year as year,
genre,
count(*) as total_movies
FROM movies.imdb_movies_rating
GROUP BY released_year, genre;
SELECT * FROM movies.year_aggregated;
SELECT count(*) FROM movies.year_aggregated;
REFRESH MATERIALIZED VIEW movies.year_aggregated;