SQL Excercises with SFPD¶
This is a landing page for a 4-part assignment of SQL exercises:
Due: Wednesday, October 24, 2017, 11:59 PM
Due: Friday, October 26, 2017, 11:59 PM
These exercises use the same SQLite database of SFPD crime incident data from 2012 through 2016. The zipped data can be downloaded here:
http://stash.padjo.org/data/sfpd-incidents-2012-2016.sqlite.zip
This data is a modified version from what SF data portal publishes:
https://data.sfgov.org/Public-Safety/Police-Department-Incidents/tmnf-yvry
Directions¶
Each exercise section has a set of exercises with a (perhaps too vague) prompt, such as:
And the expected results from a SQL query:
total_assaults¶
63874¶
You’re expected to write the query:
SELECT
COUNT(*) AS total_assaults
FROM
incidents
WHERE
category = 'ASSAULT';