Skip to content

Instantly share code, notes, and snippets.

@mmmayo13
Created February 3, 2017 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mmmayo13/e0e719794b0b9cc59eb9c9616c84e87c to your computer and use it in GitHub Desktop.
Save mmmayo13/e0e719794b0b9cc59eb9c9616c84e87c to your computer and use it in GitHub Desktop.
# births per year
q = """
SELECT
strftime("%Y", date)
, SUM(births)
FROM births
GROUP BY 1
ORDER BY 1;
"""
print sqldf(q, locals())
# strftime("%Y", date) SUM(births)
# 0 1975 3136965
# 1 1976 6304156
# 2 1979 3333279
# 3 1982 3612258
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment