Chatbot for generating SQL queries

Expert: Michael Scharpf

Industry: Finance & Insurance

Area: Finance & Controlling

Turn simple chats into powerful SQL queries: Discover our revolutionary chatbot that translates natural language into precise SQL queries and takes your data analysis to a new level.



In the past, a central bank faced a particular challenge: staff needed to be able to efficiently retrieve data from its highly confidential data lake. It was a complex process, as the AI system was not allowed to access the data lake directly for security reasons. Instead, it was to generate SQL queries that would then be executed by the employees themselves. This placed high demands on the user-friendliness and security of the solution


To overcome this challenge, we decided to develop an innovative tool, a proof of concept, which would greatly simplify the query of the data lake. Our goal was to enable the bank's staff to enter their data queries in natural language into a simple chat window. Using the Language Model (LLM) and ChatGPT, we created a system that is able to generate an SQL query from this text, which the employee can then use.

This solution combines the advantages of artificial intelligence and human input by hiding the complexity of SQL queries and allowing input in natural language instead. Our chatbot is able to interpret the questions asked and translate them into SQL code.


The implementation of this system was realised in Python and carried out in four steps. First, the Natural Language Understanding (NLU) of the entered question took place. This enabled the system to understand the meaning behind the words and sentences. Then, the recognised entities were normalised (Named Entity Normalisation) to eliminate inconsistencies in the input.

The third step involved the Data Point Model Lookup, which matched the normalised entities with the corresponding data points in the Data Lake. Finally, the system generated the SQL query that the worker could use to extract the requested data.

By implementing this solution, we were able to significantly simplify access to the data lake for the central bank's staff while ensuring the security of the data. This project is a prime example of how innovative technologies such as artificial intelligence and natural language processing can help overcome complex business challenges. That's why we stand ready to help you and your business overcome similar challenges. Our experience with projects like this makes us your ideal partner in the field of data analysis and artificial intelligence.

Curious now? Let us show you what sets us apart from other companies and how we can help you achieve your goals.

Michael Scharpf - Key Account Manager

Your expert

Michael Scharpf | Sr. Principal Key Account Manager | Alexander Thamm GmbH