Created
November 21, 2024 12:26
-
-
Save antstanley/a66a9004c3359df6f499097fd0dc34a5 to your computer and use it in GitHub Desktop.
SQL Statement to Compare Average Hours worked per country across 1990s, 2000's, and 2010's
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT "2000s".Entity, "1990s".AvgHours as "1990 - 1999", "2000s".AvgHours as "2000 - 2009", "2010s".AvgHours as "2010 - 2019" FROM (SELECT Entity, AVG("Average annual working hours per worker") AS AvgHours FROM read_csv_auto('https://ourworldindata.org/grapher/annual-working-hours-per-worker.csv?v=1&csvType=full&useColumnShortNames=true') WHERE Year BETWEEN 2010 AND 2019 GROUP BY "Entity") AS "2010s" INNER JOIN (SELECT Entity, AVG("Average annual working hours per worker") AS AvgHours FROM read_csv_auto('https://ourworldindata.org/grapher/annual-working-hours-per-worker.csv?v=1&csvType=full&useColumnShortNames=true') WHERE Year BETWEEN 2000 AND 2009 GROUP BY "Entity") AS "2000s" ON "2000s".Entity = "2010s".Entity INNER JOIN (SELECT Entity, AVG("Average annual working hours per worker") AS AvgHours FROM read_csv_auto('https://ourworldindata.org/grapher/annual-working-hours-per-worker.csv?v=1&csvType=full&useColumnShortNames=true') WHERE Year BETWEEN 1990 AND 1999 GROUP BY "Entity") AS "1990s" ON "1990s".Entity = "2000s".Entity ORDER BY "1990s".AvgHours DESC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment