From ae2e76c66357bdce031f920007cf0776127a51f8 Mon Sep 17 00:00:00 2001 From: pculliton Date: Fri, 16 Jun 2023 16:21:39 -0400 Subject: [PATCH] Update ex3.py --- learntools/sql/ex3.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/learntools/sql/ex3.py b/learntools/sql/ex3.py index f9b0f90a7..ed9ec9f55 100644 --- a/learntools/sql/ex3.py +++ b/learntools/sql/ex3.py @@ -8,8 +8,8 @@ # (1) ProlificCommenters prolific_commenters_query = """ - SELECT author, COUNT(id) AS NumPosts - FROM `bigquery-public-data.hacker_news.comments` + SELECT `by` as author, COUNT(id) AS NumPosts + FROM `bigquery-public-data.hacker_news.full` GROUP BY author HAVING COUNT(id) > 10000 """ @@ -19,7 +19,7 @@ # (2) NumDeletedPosts deleted_posts_query = """ SELECT COUNT(1) AS num_deleted_posts - FROM `bigquery-public-data.hacker_news.comments` + FROM `bigquery-public-data.hacker_news.full` WHERE deleted = True """ query_job = client.query(deleted_posts_query) @@ -47,7 +47,7 @@ def check(self, results): """ prolific_commenters_query = \""" SELECT author, COUNT(1) AS NumPosts - FROM `bigquery-public-data.hacker_news.comments` + FROM `bigquery-public-data.hacker_news.full` GROUP BY author HAVING COUNT(1) > 10000 \""" @@ -62,7 +62,7 @@ class NumDeletedPosts(EqualityCheckProblem): # Query to determine how many posts were deleted deleted_posts_query = \""" SELECT COUNT(1) AS num_deleted_posts - FROM `bigquery-public-data.hacker_news.comments` + FROM `bigquery-public-data.hacker_news.full` WHERE deleted = True \"""