Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
VinodMalleshappa authored Aug 25, 2022
1 parent 8e543f1 commit 6868d74
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
27 changes: 27 additions & 0 deletions Vinod_Malleshappa_LAB2_Exercise_1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
WITH
Movie_Ranking AS (
SELECT
Release_Date,
Movie_Title,
Production_Budget,
RANK() OVER(PARTITION BY EXTRACT(YEAR FROM Release_Date)
ORDER BY
Production_Budget DESC) AS rank
FROM
`nttdata-c4e-bde.uc1_2.Movie`
WHERE
Release_Date BETWEEN '2016-01-01'
AND '2020-12-31' )
SELECT
EXTRACT(YEAR
FROM
Release_Date) AS year,
Movie_Title,
Production_Budget,
rank
FROM
Movie_Ranking
WHERE
rank <=10
ORDER BY
year DESC
8 changes: 8 additions & 0 deletions Vinod_Malleshappa_LAB2_Exercise_3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
SELECT
visitId,
visitStartTime,
h.page.pageTitle AS pageTitle,
h.page.pagePath AS pagePath
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_20170801`,
UNNEST(hits) AS h
13 changes: 13 additions & 0 deletions Vinod_Malleshappa_LAB2_Exercise_4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
SELECT
PARSE_DATE('%Y%m%d',date) date,
h.page.pagePath pagePath,
COUNT(h.page.pagePath) counter
FROM
`bigquery-public-data.google_analytics_sample.ga_sessions_201707*`,
UNNEST(hits) AS h
GROUP BY
date,
pagePath
ORDER BY
date,
counter DESC
16 changes: 16 additions & 0 deletions Vinod_Malleshappa_LAB2_Exercise_5.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

SELECT
DISTINCT us.id AS id_user,
COUNT(pa.score) OVER(PARTITION BY PA.owner_user_id ORDER BY pa.owner_user_id) AS count
FROM
`bigquery-public-data.stackoverflow.posts_answers` pa
INNER JOIN
`bigquery-public-data.stackoverflow.users` us
ON
pa.owner_user_id = us.id
AND extract(year from pa.creation_date) = 2010
ORDER BY
count DESC
LIMIT
10

0 comments on commit 6868d74

Please sign in to comment.