added releaseYears canned query
This commit is contained in:
parent
bbb4426baf
commit
c3c42de5ff
@ -158,6 +158,7 @@
|
||||
<li><a href="#" class="query-console-sample" data-query-slug="gamesWithMostReviews">Games with most reviews</a></li>
|
||||
<li><a href="#" class="query-console-sample" data-query-slug="systemsWithMostReviews">Systems with most reviews</a></li>
|
||||
<li><a href="#" class="query-console-sample" data-query-slug="mostReviewedDomains">Domains with most reviews</a></li>
|
||||
<li><a href="#" class="query-console-sample" data-query-slug="releaseYears">Games per year</a></li>
|
||||
</ul>
|
||||
|
||||
<hr />
|
||||
@ -166,6 +167,7 @@
|
||||
<div style="text-align: center">
|
||||
<button id="query-console-run">Run</button>
|
||||
</div>
|
||||
|
||||
<div id="query-console-result-container" style="display: none">
|
||||
<hr />
|
||||
<div class="query-console-elapsed"></div>
|
||||
@ -786,6 +788,38 @@ from reviews
|
||||
where Link like 'https://%'
|
||||
group by 1
|
||||
order by 3 desc, 2 desc, 1`,
|
||||
|
||||
releaseYears: `
|
||||
with releases as (
|
||||
select
|
||||
GameID,
|
||||
(ReleaseDate || '-01-01') as ReleaseDate
|
||||
from games
|
||||
where ReleaseDate like '____'
|
||||
union all
|
||||
select
|
||||
GameID,
|
||||
(ReleaseDate || '-01') as ReleaseDate
|
||||
from games
|
||||
where ReleaseDate like '____-__'
|
||||
union all
|
||||
select
|
||||
GameID,
|
||||
ReleaseDate
|
||||
from games
|
||||
where ReleaseDate like '____-__-__'
|
||||
)
|
||||
select
|
||||
strftime('%Y', r.ReleaseDate) as Year,
|
||||
count(distinct r.GameID) as NumGames,
|
||||
avg(rev.Score) as AverageScore
|
||||
from releases r
|
||||
inner join games g
|
||||
on g.GameID = r.GameID
|
||||
inner join reviews rev
|
||||
on rev.GameID = g.GameID
|
||||
group by 1
|
||||
order by 1`,
|
||||
};
|
||||
|
||||
const query = sampleQueries[slug];
|
||||
|
Loading…
Reference in New Issue
Block a user