How to use the power of AI Chat in DBeaver

Artificial intelligence technologies are widely used in various fields, and the database world is no exception. About a year ago, we added the AI Assistant to our desktop applications, and with its help, you can generate SQL queries based on prompts written in human language. With our latest release, we have taken it further, and now you can also use the AI Chat Mode. Let’s talk about it in more detail.

How to get started with AI Chat

Today, we will return to Louis, the database expert who uses DBeaver for his work tasks and hobbies. He has just discovered the AI Chat Mode and thinks this feature might be useful for him. Let’s look at it together.

The company boss is preparing for a meeting with potential investors, so he asked Louis to help with the data for the presentation. In order to support the boss’s speech with real numbers, our hero decided to create a report consisting of information about customers and all their invoices.

To do this, he connects to a corporate database and creates a new SQL script. However, instead of writing a SQL query manually, he clicks on the AI Chat tab on the right toolbar.

He starts with the first prompt, “show all customers and invoices” and presses CTRL+Enter to send a message. However, in the AI response, he receives a SELECT query that displays only the data from the Customer table. Then, Louis tries to send the following prompt “add invoices”. This is not the result he expects.

He decides to start over and chooses the “Clear history” option from the dropdown menu near the Send button.

After thinking a little about the correct wording, he enters the “show all customers and their invoices” prompt into a field and clicks “Send” again. The result of converting the message into an SQL query appears instantly and correctly in the chat. Moreover, Louis notices that it is possible to execute the query right from the chat by clicking the corresponding button on the right side of the message received from the AI.

Louis can see that the data in the result set is not enough for his report because the purchase amounts are required for the presentation. So he adds another hint for the AI: “add total of each invoice”.

Just a final touch like adding sorting to make it more convenient to work with the report and to make it easier to show investors the biggest sales: “sort by total descending”.

In the same way as when working with the AI assistant, you don’t have to worry about your grammar.
Moreover, you can use not only English, but any other language.

Now that everything is ready, Louis can keep the result as it is. However, he decides to get rid of the IDs to make the presentation easier to read. This time he adds the “get rid of customer and invoice id” prompt.

Great job, Louis! All he has to do now is export the result set in a convenient format and email it to the manager.

Just as this feature has helped Louis, the AI Chat Mode can simplify creating your SQL queries. When you use it, you do not need to rewrite your first prompt if the result turns out to be slightly inaccurate. It is fine to just write any additional messages in the chat, after which you will receive a ready-made query that you can immediately execute and get a result set. Try this feature yourself and find out in which cases it can be useful to you.

Author: