---
title: "Discussion on \"Querying SQL DB with GPT Prompt\" | Hashnode"
description: "Discussion on \"Querying SQL DB with GPT Prompt\". LLMs appear to have boundless possibilities, and it seems like they can be used in all tasks. We can craft prompts for composing emails in a given context as well as write creative prompts to generate code in any programming language. Image a situati..."
url: "https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Querying SQL DB with GPT Prompt](https://rito.hashnode.dev/querying-sql-db-with-gpt-prompt?utm_source=hashnode&utm_medium=feed)

LLMs appear to have boundless possibilities, and it seems like they can be used in all tasks. We can craft prompts for composing emails in a given context as well as write creative prompts to generate code in any programming language. Image a situati...

Jul 22, 2023 · 8 min read · rito.hashnode.dev  
Updated Jul 30, 2023  
Read the article

-   [#chatgpt](https://hashnode.com/tag/chatgpt)
-   [#openai](https://hashnode.com/tag/openai)
-   [#langchain](https://hashnode.com/tag/langchain)
-   [#python](https://hashnode.com/tag/python)
-   [#sql](https://hashnode.com/tag/sql)

## Written by

[Ritobroto Seth](https://hashnode.com/@DevRito)

@DevRito · Bengaluru

  
[View profile](https://hashnode.com/@DevRito)

Hi, my name is Ritobroto Seth and I am a software developer with a focus on Java. I have been in the industry for around 10 years.

## Responses 7

Markdown supported · ⌘↵ to post

[karthik ale](https://hashnode.com/@karthikale)

[Jan 3, 2024](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/6594ee023cec7405d532b070)

good

[Kim Chu Wong](https://hashnode.com/@wong642)

[Jul 30, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64c6c0fcff50d1863bf772a9)

Alien Wizbot Crypto Recovery got my scammed funds back, they are the best and legitimate place where you can hire a real hacker.

[Owolabi Shehu](https://hashnode.com/@Owolex)

[Jul 25, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bf741ac6ba3a1b3898600c)

This is really cool and detail

[Ritobroto Seth](https://hashnode.com/@DevRito)

[Jul 25, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bf741ac6ba3a1b3898600c#reply-64bf7945453a851c7eb96418)

Thank you so much, Owolabi for your kind words! I truly appreciate your support and encouragement.

[Kavir Kaycee](https://hashnode.com/@kavir)

[Jul 24, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bebc6cc6ba3a1b38984f62)

Thanks for sharing this [Ritobroto Seth](https://hashnode.com/@DevRito) and for answering a similar question I had about the optimization or robustness of the query. 🙌🏽

[Ritobroto Seth](https://hashnode.com/@DevRito)

[Jul 25, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bebc6cc6ba3a1b38984f62#reply-64bf781ec6ba3a1b38986111)

Thank you, Kavir, for your encouraging comment. I'm delighted to hear that you found this post helpful.

[Abhay Singh Rathore](https://hashnode.com/@abhaysinghr1)

[Jul 23, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bd4b5f0ddc0bf1f8dd4972)

An insightful demonstration of querying SQL databases using GPT prompts, showcasing its potential applications in various tasks.

[Ritobroto Seth](https://hashnode.com/@DevRito)

[Jul 24, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bd4b5f0ddc0bf1f8dd4972#reply-64be05aa0ddc0bf1f8dd5733)

Thank you, Abhay, for your comment. I'm glad you find this post helpful.

[Ritobroto Seth](https://hashnode.com/@DevRito)

[Jul 23, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bcd49f8be04301f9cf6715)

Thanks Mayuri for your comment. Actually querying DB with LLM is still in the experimental phase and there are still a lot of open threads here.

A lot of things need to be standardized and perfected before making it production ready. Additionally, there are security concerns too that need to be addressed to prevent unwanted data leakages.

To answer your question about how optimized the query is, right now there is no benchmarking tool to measure it. Also, the response from the LLMs is non-deterministic, if ask the same question to LLM twice it might happen that both times it may return with 2 different answers. So in our case, it might be possible that the first time it returns with an optimized query and the second time it may return with an optimized query.

[Mayuri Awati](https://hashnode.com/@analyticsbymayuri)

[Jul 23, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bcd49f8be04301f9cf6715#reply-64bce8208be04301f9cf6835)

That makes complete sense Ritobroto. Thank you for the information.

[Mayuri Awati](https://hashnode.com/@analyticsbymayuri)

[Jul 23, 2023](https://hashnode.com/posts/querying-sql-db-with-gpt-prompt/64bbffd06e3bb661f128696d/comment/64bcb0870ddc0bf1f8dd3a7b)

Waw, I really loved going through it. But it made me think of how optimized or say robust is the query output. love to know your opinion.
