DEV Community

Cover image for Chat2DB: Data Analysis Without Writing SQL Code
Jing for Chat2DB

Posted on

Chat2DB: Data Analysis Without Writing SQL Code

Valuable data is often stored in various databases. To efficiently utilize this data, the most effective method is to master the database query languageโ€”SQL.

For many programmers, SQL might be the simplest programming language. However, for those who need to analyze data but lack a programming background, such as marketers, not everyone has the interest or time to learn SQL to meet the needs of data querying, analysis, and visualization in their daily work.

Fortunately, the rise of generative artificial intelligence technology, particularly text-to-SQL tools, has significantly lowered the technical threshold for data analysis, transforming what was once the domain of professional technicians into something accessible to everyone.

For example, Chat2DB aims to allow non-technical individuals to generate complex SQL queries through simple natural language inputs, and even directly generate visualized data reports, making data mastery easy for anyone.

In this blog, I'll show you how to use Chat2DB to perform professional data analysis without writing SQL code.

Step 1: Connect to the Database

First, visit the official website to download and install Chat2DB software. After installation, open the application and select the "+" in the upper left corner to add a database connection. Depending on the type of database you're using (e.g., MySQL, PostgreSQL), enter the corresponding connection information, including hostname, port number, database name, username, and password. Once set up, click "test" to test the connection. If successful, save the connection settings. This completes the preparatory work.

Image description

Image description

Step 2: Create an AI Dataset

After successfully connecting to the database, the next step is to create an AI dataset for your database.

Creating a custom AI dataset is a highlight of Chat2DB's smart Q&A feature. By synchronizing tables with complex relationships from the database into the AI dataset, AI can automatically learn these complex structures, enhancing the accuracy of text-to-SQL queries.

For example, let's choose an ERP database as an illustration. Create an AI dataset named "ERP," select all tables in the ERP database, and synchronize them into the AI dataset.

AI data collection

Step 3: Generate Visual Charts with Natural Language

Enter the Dashboard interface and create a data dashboard named "Product."

new dashboard

In the created dashboard, click the "AI Chart" option. In the input box that appears, you can express your chart requirements in natural language. For instance, you might input:

  • "Display sales revenue by product in a bar chart"
  • "Show daily income changes in a line chart"
  • "Display the percentage of total sales by product category in a pie chart"
  • "Show inventory changes over time in an area chart"

send

After entering these instructions, switch to the options column on the right, select the previously created ERP dataset as the AI dataset, and then click the "send" or "generate" button. The system will automatically generate the corresponding charts according to your instructions.

generate report

Step 4: AI-Driven Data Analysis Through Conversation

If you don't need to create a complete dashboard but want to quickly generate specific data reports, you can use the AI chat feature.

Enter the AI Chat interface and click "Create New Chat" to start a new conversation session.

AI Chat

On the left side of the input box, there are several functional options available, including Text to SQL, SQL statement explanation, SQL optimization tools, and more.

select menu

For example, if you want to know which products are currently underperforming and thus at risk of becoming obsolete, you could ask the AI: "Show me a table of products with an inventory turnover rate (inventory/sales) greater than 6." After sending, the AI will automatically extract relevant information from your ERP dataset and clearly display a list of underperforming products, helping you quickly identify inventory backlog issues.

generate table

Generated charts can also be added to previously created dashboards.

Conclusion

In this blog, we used a simple database example to demonstrate how to perform visual analysis on a database using the Chat2DB tool without writing a single line of SQL code.

If you want to learn more about techniques for database visualization, visit the official website for more practical guides and tutorials.


Community

Go to Chat2DB website
๐Ÿ™‹ Join the Chat2DB Community
๐Ÿฆ Follow us on X
๐Ÿ“ Find us on Discord

Top comments (0)