Skip to content

Instantly share code, notes, and snippets.

@ilyasahsan123
Created April 3, 2019 13:53
Show Gist options
  • Save ilyasahsan123/90e533eed49d4ff56bd36dfe7bafabd9 to your computer and use it in GitHub Desktop.
Save ilyasahsan123/90e533eed49d4ff56bd36dfe7bafabd9 to your computer and use it in GitHub Desktop.
CREATE OR REPLACE VIEW `tulisanmedium.digitalviews.top_10_most_film_by_director`
OPTIONS(
description="Top 5 most film by director for digital content purpose. requested by digital team"
)
AS
select
count(distinct title) number_of_films
,director
,string_agg(distinct title order by title limit 5) as films
from
`bigquery-public-data.san_francisco_film_locations.film_locations`
group by
director
order by
number_of_films desc
limit
10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment