Toggle navigation
Home
New Query
Recent Queries
Discuss
Database tables
Database names
MediaWiki
Wikibase
Replicas browser and optimizer
Login
History
Fork
This query is marked as a draft
This query has been published
by
Shringa13
.
In the query, I have tried to apply PIVOTING to show results in a more understandable format.
Toggle Highlighting
SQL
use enwiki_p; SELECT f.year, Max(f.sugar) AS Sugar, Max(f.salt) AS Salt FROM (SELECT s.year, CASE WHEN s.ingredient_page = 'Sugar' THEN s.edits ELSE 0 END AS 'Sugar', CASE WHEN s.ingredient_page = 'Salt' THEN s.edits ELSE 0 END AS 'Salt' FROM (SELECT Extract(year FROM r.rev_timestamp) AS year, p.page_title AS ingredient_page, Count(r.rev_page) AS edits FROM revision r, page p WHERE r.rev_page = p.page_id AND ( r.rev_page = 27712 OR r.rev_page = 1605200 ) GROUP BY year, ingredient_page) AS s) AS f GROUP BY f.year
By running queries you agree to the
Cloud Services Terms of Use
and you irrevocably agree to release your SQL under
CC0 License
.
Submit Query
Stop Query
All SQL code is licensed under
CC0 License
.
Checking query status...