Creating Custom Visualizations with DbVisualizer
Published: 2023-07-20 07:00:00

**As a data analyst or developer, this article will guide you through creating stunning visualizations with DbVisualizer.**

---

### _Tools used in this tutorial_
[DbVisualizer](https://www.dbvis.com/download/), top rated database management tool and SQL client

---

## Introduction
As a data analyst or developer, you're probably no stranger to dealing with large datasets, and we all know the importance of visualizing our data. Let's face the facts, going through large bulks of rows and columns can be tedious and overwhelming. That's where DbVisualizer comes in - a powerful tool that makes it easy for anyone, design expert or not, to create custom visualizations.

This article will guide you through creating stunning visualizations with DbVisualizer. From the tools you'll need, to the step-by-step instructions on how to create them. Whether you're a data analyst looking to make sense of your data or a developer working on a project that requires visual representation, this article is for you. By the end of it, you'll have the knowledge and skills to turn your data into meaningful insights.

## Getting Started
Are you ready to dive into the world of data visualization? Great! Let's get started by using DbVisualizer to connect to our database server. Don't worry if you're new to this process, just follow the step-by-step guide and you'll be a pro in no time.

### Step 1: Connecting To The Database Server
First, we'll need to use the DbVisualizer program to establish a connection to our database server. To establish a connection to a database server in DbVisualizer, create a new database connection from the "Create Database Connection" menu, select a driver for your database, and enter the connection details such as the name, database type, server IP, port, user account, and password. Optionally, you can specify auto commit, save database password, and permission mode. If the JDBC driver is not marked with a green checkmark, you may have to configure the driver in the Driver Manager. Verify the network connection and click "Connect" to access the database.

Once you've successfully established a connection, all of your databases will appear on the left side of the screen. Now, it's time to create a new database for this tutorial. The process is simple, just right-click on "Databases" and select "create database." It's that easy! So, let's get started and create a new database that will be the foundation for all of your future projects.
<br />
![Creating a database.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/no3y6fm6yljda0f4rfvo.png)
<figure><figcaption>Creating a database.</figcaption></figure>
<br />

### Step 2: Creating The Database Table
After connecting to the database server, you would want to create a new table next. All you need to do is right-click on the "Tables" option in your document and select "Create Table".
<br />
![Creating a table.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mn3n1jl2cxptbhfiwa0.png)
<figure><figcaption>Creating a table.</figcaption></figure>
<br />
The “Create Table” dialog will be displayed. Give your database a name that reflects its purpose and content. Next, add columns to your database by clicking the handy "+" button on the right side of the dialog box. Once you've finished customizing your columns, it's time to bring your database to life. Simply click on "Execute", and voila! Your database is ready for use.
<br />
![The Create Table dialog.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tzlasxht4sfg0qnve3cn.png)
<figure><figcaption>The Create Table dialog.</figcaption></figure>
<br />
Don't let the technicalities intimidate you; working with databases in DbVisualizer has never been easier.

You will now be able to find your table in the list of tables in your database.

### Step 3: Import Table Data
For this part, download the csv file that we'll be using throughout this tutorial. To impor thet data into your newly created table, right-click on the table and select the option "Import Table Data." An import wizard will come up, allowing you to import data from any source, including Excel and CSV files. Not only is this a quick and convenient way to populate your table with data, but it also ensures that your data is properly formatted and ready to be analyzed.
<br />
![Importing data to a table.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/locrttqpo3fcaa27h3zh.png)
<figure><figcaption>Importing data to a table.</figcaption></figure>
<br />
Select the downloaded CSV file from your pc and import it.
<br />
![The Import Wizard.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5ovkih5buslk781onbn.png)
<figure><figcaption>The Import Wizard.</figcaption></figure>
<br />
Navigate through the pages by clicking on the "Next" button until you reach the final page. Once you have reached the last page, initiate the import process by clicking on the "Import" button. If all goes well, you will get a success message indicating that your data has been imported successfully. Don't fret if you don't see this message, double check your steps and try again.
<br />
![The importing process has been completed.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/b7xp912z73um2eruwzp3.png)
<figure><figcaption>The importing process has been completed.</figcaption></figure>
<br />
Your database will be populated with data from the CSV file and would be displayed in DbVisualizer.
<br />
![Data from the CSV file.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/g20v4uvdpf5983cnca2i.png)
<figure><figcaption>Data from the CSV file.</figcaption></figure>
<br />

## Creating the Visualizations
Now that our table is fully populated, let's create our visualizations. By using SQL, we have the power to create a wide range of analytical queries on this table. Let's take a look at a few examples of what we can achieve:

### 1. Total sales by Product
From the table above we want to find the total sales for each product. Copy the SQL query below and run it.

```
1 SELECT product, SUM(quantity * price) AS total_sales
2 FROM salesdata
3 GROUP BY product
```
Running the query above will provide you with the results seen in the table below:
<br />
![Query for total sales by product.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6us2bqwo5hca3nor8wmd.png)
<figure><figcaption>Query for total sales by product.</figcaption></figure>
<br />
To create a visualization for this table, click on the rightmost button in the result tab toolbar.
<br />
![The Show as Chart button.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3cq2f3jevpjg4abdfzkq.png)
<figure><figcaption>The Show as Chart button.</figcaption></figure>
<br />
Great! We have successfully created a visualization of our total sales data. By default, the visualization displays a line chart, but don't let that limit you. Get creative and explore the various customization options available to you. You can try out options like line chart, point chart, area chart, stacked area chart, bar chart, stacked bar chart and pie chart.
<br />
![Chart for total sales by product.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3fsirfndhiwg9s88xkdw.png)
<figure><figcaption>Chart for total sales by product.</figcaption></figure>
<br />

### 2. Total sales per day
We have successfully visualized the query for “Total sales per product”, next we want to find the total sales per day for each product in the table above. Copy the SQL query below and run it.

```
1 SELECT date(date) as day,
2    SUM(CASE WHEN product = 'product1' THEN quantity * price ELSE 0 END) AS product1_sales,
3    SUM(CASE WHEN product = 'product2' THEN quantity * price ELSE 0 END) AS product2_sales
4 FROM salesdata
5 GROUP BY day
6 ORDER BY day;
```
Running the query above will provide you with the results in the table below:
<br />
![Query for total sales per day.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dnty2cbprri2lewnrhb5.png)
<figure><figcaption>Query for total sales per day.</figcaption></figure>
<br />
Let's bring the data to life by converting it into a visually appealing chart. First, go to the chart tab at the top of your screen. Then, click on the chart icon to reveal a dropdown menu of various chart types.
<br />
![Menu - types of charts.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qn6fcfpsx5fmfp3s0xmv.png)
<figure><figcaption>Menu - types of charts.</figcaption></figure>
<br />
Let’s try creating a stacked area chart with our data. To achieve this, click on the button in the image provided to access the value selection options. Next, choose the product values for the y-axis and the days values for the x-axis.
<br />
![Choosing the axis values.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8edfrlyepvjiruyz0ow.png)
<figure><figcaption>Choosing the axis values.</figcaption></figure>
<br />
Voila! Just like that we have our stacked area chart visualization.
<br />
![Stacked area chart.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eswajabxxpkex0zyzlxi.png)
<figure><figcaption>Stacked area chart.</figcaption></figure>
<br />
And if you prefer a stacked bar chart, here’s what it’ll look like.
<br />
![Stacked bar chart.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4jt1s4al7ef5hzkhu02g.png)
<figure><figcaption>Stacked bar chart.</figcaption></figure>
<br />
Pretty neat right? DbVisualizer also allows various configuration options. To access these options, click on the tool button at the top of the chart tab. From there, you can configure your charts to best suit your needs. And once you've created the perfect chart, you can export it as an image by clicking on the document icon at the top of the chart tab.
<br />
![Chart configuration options and Export chart buttons.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rcei4kwycs2nj8tvbg97.png)
<figure><figcaption>Chart configuration options and Export chart buttons.</figcaption></figure>
<br />

## Conclusion
Creating custom visualizations with DbVisualizer is a breeze when you know the steps. In this article, we delved into the nitty-gritty of setting up a database connection and gathering the data you need for your visualization. We also explored the various options for configuring your visualization, from adding layers to customizing the layout.

But we didn't stop there - we emphasized the importance of adding annotations to your visualization to provide context and clarity for key findings. By following the instructions outlined in this article, you'll be able to create visually compelling and informative visualizations that will help you understand your data better and communicate your findings to others.

Now that you've read the article, it's time to put your newfound knowledge to the test! Apply the concepts discussed in the tutorial to your own data, experiment with different visualization options, and take a deeper dive into the software by reading the official documentation. You can also explore ways to make your visualization more interactive and engaging for your audience. With more practice and experimentation, you'll be creating custom visualizations like a pro in no time.

## About the author
Ochuko Onojakpor is a full-stack Python/React software developer and freelance Technical Writer. He spends his free time contributing to open source and tutoring students on programming in collaboration with Google DSC.