Earlier quoted context omitted.
> Usually start with "select * from table limit 10", look at the columns and data available, and then start refining. An experienced person won't do that. For any moderately complex SQL query, before writing it I already have in mind the several jointures I'll need, since I usually know the tables and FK I'm working with. It's like following the edges of a graph, all in my head. But I don't know all the fields of the…
> have in mind the several jointures I typically keep all JOINs I've ever used on that schema in a single file, one per line. Before writing a new query I can just copy paste some JOINs, simply skimming through table names like lego bricks. That way it's surprisingly easy to beam from domain problem to a new query that uses 10 or 20 tables. I've just realized that it might be all archaic now, in LLM era.
You have a library of useful joins that you've checked for correctness. Saving the library as reusable code would be even more useful.