Question: Please help me to write 1 SQL queries On average which URL produced the best story in 2010? Schema: id INTEGER NULLABLE Unique story ID

Please help me to write 1 SQL queries

On average which URL produced the best story in 2010?

Schema:

id

INTEGER NULLABLE

Unique story ID

by STRING NULLABLE

Username of submitter

score INTEGER NULLABLE

Story score

time INTEGER NULLABLE

Unix time

time_ts TIMESTAMP NULLABLE

Human readable time in UTC (format: YYYY-MM-DD hh:mm:ss)

title STRING NULLABLE

Story title

url STRING NULLABLE

Story url

text STRING NULLABLE

Story text

deleted BOOLEAN NULLABLE

Is deleted?

dead BOOLEAN NULLABLE

Is dead?

descendants INTEGER NULLABLE

Number of story descendants

author STRING NULLABLE

Username of author

I figured it out. Thanks anyway.

SELECT

url,

avg(score) as avg_score,

time_ts as TIME_STAMP

FROM [bigquery-public-data.hacker_news.stories]

where YEAR(time_ts) = 2010

GROUP BY url, TIME_STAMP

ORDER BY avg_score DESC

LIMIT 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!