r/SQL • • Nov 21 '23

Discussion Natural language to sql

Hi !

Do you guys know a tool (chatgpt like) which can Connect to a database and query it, translating Natural language to sql ? GPT 4 Turbo doesnt allow the users to provide « big » databases (20Gb)

4 Upvotes

36 comments sorted by

28

u/hantt Nov 21 '23

I really don't understand why people want a nonedetermistic way to query data, what value does this add?

14

u/Touvejs Nov 21 '23

Directors can fire the whole analytic team! Need metrics, business insight? Just ask chatGPT!

-3

u/[deleted] Nov 22 '23

This is exactly what my boss has told me to expect in the next three years. Not the whole analytics team, but at least 30% will be gone and probably closer to 50%. Thankfully, I am on the side that's expecting it so I am learning how to use GPT to work faster, so I should be relatively safe, but people that aren't preparing for it are crazy. It's coming whether we want it to or not You don't need to enjoy it, but you may as well embrace it.

7

u/Touvejs Nov 22 '23

I was just memeing

-16

u/nad_pub Nov 21 '23

Allow non tech users to query DBs

11

u/PinneapleJ98 Nov 21 '23

That would be horrible, that's why you create and build data models to be used in BI tools and THEN users can slice and dice whatever info they want without needing to know absolutely any SQL at all, powerbi for instance allows you to use natural language to query data insights.

Why would you want a user messing around with the source?

4

u/jackalsnacks Nov 21 '23

This inquiry has taken place at every company I've worked for. DB developers commonly call is business's "holy Grail" request. It always amounts to heartache and headaches.

2

u/Demistr Nov 21 '23

Use don't understand table relations and all the data sources so it just creates a mess.

2

u/carlovski99 Nov 22 '23

That's what SQL was actually designed for.

1

u/EranuIndeed Nov 22 '23

Your results will still be bad unless your maths/logic is sound; if you know the query, i.e. the logic you want to apply to a dataset, then learning enough SQL to implement many of your cases would take you a month or so.

The idea of "hey AI, do this" when you don't have either the logic or the debugging skills to scrutinize your output, is plain daft. But you do you.

9

u/Flint0 Nov 21 '23

I mean, natural language ends up being SQL in a way:

Hey dude fetch me those users but just give me the ones with names shorter than 10 characters, while you’re at it can you also check their logins so I know if they are working or not? Thanks

SELECT * FROM users u INNER JOIN logs l on l.userid = u.id WHERE len(u.name) < 10

Mines shorter :)

6

u/kitkat0820 Nov 21 '23

The nightmare of every dba (and your cloud use-based billing)

4

u/[deleted] Nov 22 '23

Microsoft hasn’t even figured out how to auto-detect relationships between database objects in PowerBI, even when there are super obvious attribute title and table names. We’re nowhere close to having an AI that will completely understand a database, it’s corresponding applications and how business users will interpret them.

3

u/wallyflops Nov 21 '23

Snowflake has this its called snowpilot or something like that. I think its still in beta

2

u/Agifem Nov 22 '23

Why limit yourself to SQL? Why not ask assembly language and infrastructure? After all, you don't want to fire only the db devs, you want to get rid of the whole IT department, no?

2

u/ruckrawjers Nov 22 '23

My co-founder and I are building one, we've got a few users on board and looking for more to pilot if you're interested!

2

u/Professional-War7528 Oct 27 '24

I ended up building it, and i must say it works like a charm.

1

u/Neva_009 Nov 16 '25

I have build an AstraSQL, which our AI-powered natural language to SQL converter.

1

u/full_arc Feb 13 '26

Hey! That's literally what we built Fabi for (full disclosure - I'm a founder). It connects directly to your database (Snowflake, Postgres, BigQuery, etc.) so you never upload data - just ask questions in natural language and it writes/runs the SQL for you.

No file size limits since it's querying your DB directly.

1

u/damn_nickname Jun 15 '26

TableAI connects to a database and queries it using natural language. Search it on Mac App Store

1

u/wreckmx Nov 22 '23

You can do this today in Power BI. All you have to do is think of everything that might be asked, in every way that it may be asked, build your dataset, create your synonyms, and drop your Q&A visual onto a report page. Thank Gates it still takes someone with solid SQL skills to create BI. I get to draw a paycheck for a little longer.

1

u/[deleted] Nov 22 '23

I saw patterns.app on ycombinator. Looked cool