I think this `sql` declaration could be hoisted out and reused for both clauses to avoid some code duplication.