Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started