Live data from Hacker News

Getting AI to write good SQL

cloud.google.com

321–330 of 379 posts

Re: Getting AI to write good SQL

#322

I understand from a technical POV how this could be considered great news. But I don't see how this is good news at all from a societal POV. The last 15 or so years has seen an unprecedented rise in salaries for engineers, especially software engineers. This has brought an interest in the profession from people who would normally not have considered SW as a profession. I think this is both good and bad. It has brough…

I understand how, from a technical POV, electricity and electrification could be considered great news. But I don't see how this is good news at all from a societal POV. Think about all the lamplighters who lost their jobs. Streetlights just turn on now? Lamplighting used to be considered a stable job! And what about the ice cutters… For real tho, it's not like there's nothing left to do — we still have potholes to f…

how is that technological progress not fueling resource scarcity?

Re: Getting AI to write good SQL

#323

Earlier quoted context omitted.

I’ve yet to see any llm proselytizers acknowledge this glaring fact: Each new release is “game changing”. The implication being the last release y’all said was “game changing” is now “from a different century”. Do you see it? For this to be an accurate and true assessment means you were wrong both before and wrong now.

I'm unsure I fully understand your contention. Are you suggesting that a rush to hyperbole which you don't like means advances in a technology aren't groundbreaking? Or is it that if there is more than one impressive advance in a technology, any advance before the latest wasn't worthy of admiration at the time?

Yes, it’s the hyperbole.

This is, at best, an incremental development of an existing technology.

Though even that is debatable considering the wildly differing opinions in this thread in regards to this vs other models.

Re: Getting AI to write good SQL

#324
SQL Data analyst with years and years of experience here.

Most of my roles were in small teams building quick ad-hoc analyses for business leaders in large multi billion dollar businesses. Example, one db was Oracle e-business suite. It had been set up ~20 years prior with enhancements along the way. There were only a handful of people in the company who knew what the fields helpfully named like ATTR_000349857. Everyone was overworked with urgent requests (and occasional layoffs) and no one bothered to spend time on documenting the database. I suppose this topic fits under "Provide business-specific context". Great, hire someone to understand and document all that crap. Ain't going to happen.

The other roles also fit this pattern, different systems but urgent needs, always a drought of people who understood both the business and the database.

Occasionally we'd get some "AI team" come looking for "data". After many mindless meetings with no clear objective except "increase profits", they'd quietly disappear.

I use stack overflow a lot to pull SQL examples and tweak. A lot of AI talk feels like hype -- to start with, i'd suggest not redefining words like "hallucination", "intelligence" etc which mean something else in English. Maybe call it "advanced algorithms" and stop with the hype. Also the surveillance and extraction of user data for advertising. Thank you.

Re: Getting AI to write good SQL

#325
post #315
post #276

Earlier quoted context omitted.

Can you provide your prompt? This hasn't matched my experience. You can also try enabling search grounding in the right hand bar. You have to also explicitly tell it in your prompt to use grounding with Google Search, but I've had very good success with that even for recent or niche plugins/libraries.

So glad we're pinning the success and learning of new technology on random anecdotes. Do pro AI people not see how untenable it is where everything is a rumor?

It is only a rumor to people who refuse to put in effort.

Re: Getting AI to write good SQL

#326

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.

Having written more SQL than any other programming language by now, every time I've tried to use AI to write the query for me, I'd spend way more time getting the output right than if I'd just written it myself. As a quick aside there's one thing I wish SQL had that would make writing queries so much faster. At work we're using a DSL that has one operator that automatically generates joins from foreign key columns, j…

Can't recommend dbt highly enough to get over the SQL boilerplate problem. After using dbt for a few years it's unimaginable to work without it.

Re: Getting AI to write good SQL

#327

I understand from a technical POV how this could be considered great news. But I don't see how this is good news at all from a societal POV. The last 15 or so years has seen an unprecedented rise in salaries for engineers, especially software engineers. This has brought an interest in the profession from people who would normally not have considered SW as a profession. I think this is both good and bad. It has brough…

While AI can empower experts with strong prompt engineering skills, I don’t believe it enables the creation of truly complex solutions unless the user already possesses the necessary expertise. For seasoned developers, these tools are fantastic. For those without a software background, they appear almost magical. But people shouldn’t build solutions they don’t fully understand, it leads to a maintainability nightmare.

Re: Getting AI to write good SQL

#328
post #222

Can I just say that Google AI Studio with latest Gemini is stunningly, amazingly, game changingly impressive. It leaves Claude and ChatGPT's coding looking like they are from a different century. It's hard to believe these changes are coming in factors of weeks and months. Last month i could not believe how good Claude is. Today I'm not sure how I could continue programming without Google Gemini in my toolkit. Gemini…

I tried it out because of your comment and the very first prompt Gemini 2.5 Pro hallucinated a non-existant plugin including detailed usage instructions. Not really my idea of good.

This has consistently been my experience with every LLM I have tried. Everybody says "Oh, you tried it one the model from two months ago? Doesn't count, the new ones are sooo much better". So I try the new one and it still hallucinates.

Re: Getting AI to write good SQL

#329

Earlier quoted context omitted.

It is absolutely the greatest golden age in programming ever - all these infinitely wealthy companies spending bajillions competing on who can make the best programming companion. Apart from the apologising. It's silly when the AI apologises with ever more sincere apologies. There should be no apologies from AIs.

> It is absolutely the greatest golden age in programming ever It depends, because you now have to pay in order to be able to compete against other programmers who're also using AI tools, it wasn't like that in what I'd call the true "golden age", basically the '90s - early part of the 2000s, when the internet was already a thing and one could put together something very cool with just a "basic" text editor.

One could put something cool together without internet using Delphi. The Borland IDEs were ahead of their time - built-in debugger, profiler, and pretty good documentation. My 'internet' was the SWAG Pascal snippet collection (which could be used fully offline). Someone converted it to HTML:

http://www.retroarchive.org/swag/index.html

Re: Getting AI to write good SQL

#330

The game changer for me will be when AI stops hallucinating SDK methods. I often find myself asking ”show me how to do advanced concept X in somewhat niche Y sdk”, and while it produces confident answers, 90% of the time it is suggesting SDK methods that do not exist, so a lot of time is wasted just arguing about that

I wouldn't be surprised if some of these hallucinations were actual custom code samples in the same namespace that they have access to, but can't attribute due to IP issues.
Post reply on HN