Field Note No. 09 SQL Municipal Finance Lab 5 min read

The question comes before the query.

SQL started making more sense when I stopped asking only how to write the command and started asking what business question the command was supposed to answer.

At first, learning SQL felt like memorizing a list of commands. SELECT does this. JOIN does that. GROUP BY goes somewhere after WHERE. Semicolons matter. The terminal and psql are not the same place. All of that was true, and I needed to learn it.

But the work did not really start feeling useful until Municipal Finance Lab turned into a small reporting environment. Once the tables had taxpayers, tax types, assessment statuses, and assessment amounts, the question changed.

It was no longer just, "Can I write a JOIN?" It became, "Which assessments are delinquent?" "Which tax types carry the largest balances?" "What should a manager look at first?" That shift matters.

Syntax tells the database what to do. The business question tells you why you are asking.

What changed

The same SQL command feels different depending on the question behind it. A SUM can be a math exercise, or it can be a revenue summary. A JOIN can be a table trick, or it can turn system IDs into names a person can actually read. GROUP BY can be syntax, or it can be the difference between a pile of records and a management report.

Syntax question

How do I write GROUP BY?

Analyst question

What category should this report summarize by?

Syntax question

How do I join these tables?

Analyst question

Which hidden IDs need to become readable names for the person using the report?

Syntax question

How do I sort the result?

Analyst question

What should rise to the top so someone knows where to act first?

The sandbox changed the feeling

Five rows were enough to learn the commands. They were not enough to make the reporting feel real. The practice database with 500 taxpayer accounts changed that. Suddenly, sorting mattered. Counts mattered. Totals by status mattered. Mistakes became easier to make, but they also became safer to learn from because the sandbox was built for practice.

That is the bigger lesson I want to keep: learning gets better when the practice environment is close enough to the real thing to make the questions meaningful.

What I am practicing now

The next stage is not just writing more SQL. It is building the habit of translating plain-language questions into useful reports. That means starting with the person who needs the answer, the decision they are trying to make, and the shape of the output that would help.

The query still matters. It has to be correct. But correctness is not the whole job. The report has to be useful to someone besides the person who wrote it.

One Thing To Try This Week

Before writing any SQL query, write the business question in one sentence. Then write who would use the answer and what action they might take from it.

If you cannot explain the question in plain language, the query is probably not ready yet.