Please help me to write the following SQL queries in Big Query(SQL) List how man
ID: 3805302 • Letter: P
Question
Please help me to write the following SQL queries in Big Query(SQL)
List how many stories were posted by each author on nytimes.com and wired.com. (those two web sites are in the filed of url)
Schema:
id
Unique story ID
Username of submitter
Story score
Unix time
Human readable time in UTC (format: YYYY-MM-DD hh:mm:ss)
Story title
Story url
Story text
Is deleted?
Is dead?
Number of story descendants
Username of author
id
INTEGER NULLABLEUnique story ID
by STRING NULLABLEUsername of submitter
score INTEGER NULLABLEStory score
time INTEGER NULLABLEUnix time
time_ts TIMESTAMP NULLABLEHuman readable time in UTC (format: YYYY-MM-DD hh:mm:ss)
title STRING NULLABLEStory title
url STRING NULLABLEStory url
text STRING NULLABLEStory text
deleted BOOLEAN NULLABLEIs deleted?
dead BOOLEAN NULLABLEIs dead?
descendants INTEGER NULLABLENumber of story descendants
author STRING NULLABLEUsername of author
Explanation / Answer
First query for List how many stories were posted by each author on nytimes.com:
SELECT
title,
COUNT(descendants)
FROM Schema
WHERE author='xyz' AND url="nytimes.com";
Second query for List how many stories were posted by each author on wired.com:
SELECT
title,
COUNT(descendants)
FROM Schema
WHERE author='xyz' AND url="wired.com";