Live data from Hacker News

How to generate SQL statements with ChatGPT

forta.com

21–30 of 48 posts

Re: How to generate SQL statements with ChatGPT

#21
post #7

If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct? I had to forbid my coworkers from using chatgpt to generate SQL because it kept doing things slightly wrong - like missing parens when dealing with AND and OR in a where statement.

> If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct?

This line of reasoning applies for all areas of knowledge, and I wish more people would realize this about LLMs.

Re: How to generate SQL statements with ChatGPT

#22
post #13

I really don't see how english is a better query language than SQL. Yes, SQL has a bunch of sharp corners you have to learn, but plain english can be very ambiguous. Creating an interface that that is simple at low query complexity is easy. A good interface is the one that still makes sense when queries get complicated. And to be fair, even SQL is not that good at that.

> I really don't see how english is a better query language than SQL.

People have been trying to develop "natural" programming languages since the advent of programming, and I think we can say that it's pretty much never going to work. The things that make natural language desirable (such as semantic ambiguity, individualized expression, inherent adaptability, etc) are almost exactly the things that you absolutely don't want to get involved when interfacing with computers. Programming languages lack these traits, which makes them predictable and dependable in a way natural language simply isn't, which is why they're good for interfacing with computers.

Re: How to generate SQL statements with ChatGPT

#23
post #7

If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct? I had to forbid my coworkers from using chatgpt to generate SQL because it kept doing things slightly wrong - like missing parens when dealing with AND and OR in a where statement.

I know (some) French, still use ChatGPT or Google Translate a lot to get me started if I want to send a note to someone in French. I still do some hand-waving afterwards to ensure it's correct but that's about it.

I'd argue that this process applies to any GPT-type generator, it serves a starting point so you're not staring at a blank piece of paper, but it won't give you the final result.

Re: How to generate SQL statements with ChatGPT

#24
post #23
post #7

If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct? I had to forbid my coworkers from using chatgpt to generate SQL because it kept doing things slightly wrong - like missing parens when dealing with AND and OR in a where statement.

I know (some) French, still use ChatGPT or Google Translate a lot to get me started if I want to send a note to someone in French. I still do some hand-waving afterwards to ensure it's correct but that's about it. I'd argue that this process applies to any GPT-type generator, it serves a starting point so you're not staring at a blank piece of paper, but it won't give you the final result.

The benefit of using GPT to produce something for another human is the other human can understand you even if the statement is slightly weird or incorrectly worded.

SQL doesn’t have the same tolerance.

Re: How to generate SQL statements with ChatGPT

#26
post #17

I've spent a lot of time on this problem space for our business. My current conclusions are as follows: Writing the actual SQL query is not the hard part for us. The hardest part is exhaustively expressing our intention in any language at all , followed closely by its apprentice - the incomplete requirements monster. I've found that if I can coach a team member into giving me a proper natural language statement that…

>>*...Anything serious...*

My problem is that I simply cannot trust any data coming from GPT - it doesnt have real-time info, it constantly tells me what it CANT DO and its never able to tell me what it CAN DO.

The platform is extremely powerful, and what we are seeing is that the cadre of AI LLMs/apps that are coming about has all the devs/companies frantically running in a panic on how to both weaponize and monetize.

Re: How to generate SQL statements with ChatGPT

#27
post #17

I've spent a lot of time on this problem space for our business. My current conclusions are as follows: Writing the actual SQL query is not the hard part for us. The hardest part is exhaustively expressing our intention in any language at all , followed closely by its apprentice - the incomplete requirements monster. I've found that if I can coach a team member into giving me a proper natural language statement that…

>>* ...Anything serious...* My problem is that I simply cannot trust any data coming from GPT - it doesnt have real-time info, it constantly tells me what it CANT DO and its never able to tell me what it CAN DO. The platform is extremely powerful, and what we are seeing is that the cadre of AI LLMs/apps that are coming about has all the devs/companies frantically running in a panic on how to both weaponize and moneti…

That issue seems entirely mitigated by thorough testing.

Re: How to generate SQL statements with ChatGPT

#28
post #7

If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct? I had to forbid my coworkers from using chatgpt to generate SQL because it kept doing things slightly wrong - like missing parens when dealing with AND and OR in a where statement.

Most people can read more complicated text than they can write.

Most people who need to generate a query can run it and look at the results.

I use chatgpt to help me, particularly with languages I don’t write in everyday. And I often find myself arguing with chatgpt that what it wrote is wrong, because I can read the query, but don’t know how to write the query I need.

Re: How to generate SQL statements with ChatGPT

#29
post #7

If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct? I had to forbid my coworkers from using chatgpt to generate SQL because it kept doing things slightly wrong - like missing parens when dealing with AND and OR in a where statement.

> If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct?

You test it.

And what do you mean by “know SQL?” No one knows everything about SQL. Virtually everyone writing SQL is in between the two extreme cases you provide.

Re: How to generate SQL statements with ChatGPT

#30
post #7

If you know SQL why is this better than just writing SQL? If you don’t know SQL how do you know it’s correct? I had to forbid my coworkers from using chatgpt to generate SQL because it kept doing things slightly wrong - like missing parens when dealing with AND and OR in a where statement.

Most people can read more complicated text than they can write. Most people who need to generate a query can run it and look at the results. I use chatgpt to help me, particularly with languages I don’t write in everyday. And I often find myself arguing with chatgpt that what it wrote is wrong, because I can read the query, but don’t know how to write the query I need.

I agree with your sentiment but it actually occurred to me that code might actually be the reverse - where you can write more complicated code than you can read.
Post reply on HN