3 ms·
Haha, that’s not even SQL. But I am interested in how it turns the request into SQL (if that’s what it does).
by sroussey 3y ago
Haha, that’s not even SQL.
But I am interested in how it turns the request into SQL (if that’s what it does).
- lgas 3y agoTypically you feed the schema in as context and literally just ask the model to turn it into SQL. So a prompt of the format "Given this schema {schema}, turn this query into SQL. {query}. Return the SQL and nothing else."
- sroussey 3y agoI would guess a codex llm would do that, but hopefully the question by the user doesn’t end up being a delete statement, lol.
- lgas 3y agoYou can either have it show you the statement to confirm before executing it, or if you only want to do queries you can use a read-only database connection.
- sroussey 3y agoOr perhaps create a lot of “known” queries as templates with good paragraph explanations and use the question to do a search for the known query. I’m new to AI so curious how it’s best utilized.
- woadwarrior01 3y ago> Haha, that’s not even SQL. It is in the MSSQL[1] world. I haven't touched it in ~20 years and I can still recognise it. [1]: https://learn.microsoft.com/en-us/sql/t-sql/queries/top-transact-sql?view=sql-server-ver16 https://learn.microsoft.com/en-us/sql/t-sql/queries/top-tran...
- sroussey 3y agoInteresting! I haven’t felt with MSSql since the early 1990s. And I didn’t know the TOP(10) even back then I would guess. Does it also let you not name what you are sorting on?