Last active
February 3, 2025 09:25
-
-
Save sspaeti/64405c15ef5b0f969435195cbdd05c04 to your computer and use it in GitHub Desktop.
This queries a shared DuckDB database on MotherDuck with StackOverflow Survey
This file contains 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
--connect to MotherDuck databases | |
-- configure MOTHERDUCK_TOKEN and run DuckDB that connects to all shared Databases with | |
-- `duckdb "md:"` | |
-- and then run this query: | |
WITH language_counts AS ( | |
SELECT | |
language, | |
COUNT(*) AS count | |
FROM ( | |
SELECT UNNEST(STRING_SPLIT(LanguageHaveWorkedWith, ';')) AS language | |
FROM sample_data.stackoverflow_survey.survey_results | |
WHERE year='2024' | |
) AS languages | |
GROUP BY language | |
), | |
max_count AS ( | |
SELECT MAX(count) as max_value | |
FROM language_counts | |
) | |
SELECT | |
language, | |
count, | |
bar(count, 0, max_count.max_value, 40) as chart | |
FROM language_counts, max_count | |
ORDER BY count DESC | |
LIMIT 10; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment