Strongly agree. LLMs need something more than just the DDL of the tables and an instruction to write useful SQL in the real world.
However, I've had decent success by (1) integrating heavily with a semantic layer on top of your database, and (2) going the agent approach where the LLM is allowed to run different queries and explore the data before writing the final query.