# Optional SQL route

This is a separate implementation of the case calculations, not a wrapper around the Python answer. It uses a local in-memory SQLite database populated from the supplied CSVs. No database account, server or paid service is needed.

Run `python run_sql.py` to execute the reference `analysis.sql`. To do the work yourself, copy `sql-starter.sql`, write your views, and run `python run_sql.py your-analysis.sql`. The runner looks for an `exceptions` view and a one-row `report`. The starter deliberately does not pass.

The importer checks CSV headers and basic numeric/date shapes, but the SQL must still handle record identity, population and missingness. Read its intermediate views, not only the final total. The included SQL is scoped to the supplied exercise and is not production code or a universal source-data validator.

Python 3.10 or later with SQLite 3.25 or later is needed for the window-function example. The normal Python 3.10+ standard-library route is also included in `solve.py`. Do not execute SQL files from untrusted sources.

To make this evidence of your own skill, implement the query before reading the reference. Then change one input condition and explain the effect. Listing SQL on a résumé should reflect work you can actually explain and modify.

Primary syntax references: https://www.sqlite.org/lang_with.html and https://www.sqlite.org/windowfunctions.html .
