←back to thread

Getting AI to write good SQL

(cloud.google.com)
478 points richards | 4 comments | | HN request time: 0s | source
Show context
mousetree ◴[] No.44010169[source]
Out of all the AI tools and models I’ve tried, the most disappointing is the Gemini built into BigQuery. Despite having well named columns with good descriptions it consistently gets nowhere close to solving the problem.
replies(2): >>44010326 #>>44010346 #
1. quantadev ◴[] No.44010326[source]
Having proper constraints and foreign keys that are clear is generally all that's needed in my experience. Are you sure your tables have well defined constraints, so that the AI can be absolutely 100% sure how everything links up? SQL is very precise, but only if you're utilizing constraints and foreign key definitions well.
replies(1): >>44010802 #
2. carderne ◴[] No.44010802[source]
It’s BigQuery, so it likely won’t have any of these.
replies(1): >>44011188 #
3. quantadev ◴[] No.44011188[source]
BigQuery supports all those SQL things I mentioned.
replies(1): >>44011214 #
4. carderne ◴[] No.44011214{3}[source]
I’m just saying it’s likely they aren’t using them. But clearly you should if you want LLMs to do anything useful.