How to Create SQL Dashboards: SQL Data Visualization
Tags: webdev, mysql, database, softwareengineering
Published: 2023-05-31 02:24:20

Data visualization through charts, dashboards, or data grids is a critical task of enterprise IT, business, and data analyst teams. As most enterprise data is stored in relational databases, let's explore how to create<strong> SQL dashboards and data grids</strong> using Five.

<hr />

<strong>Charts and dashboards</strong> are often the first steps that businesses take toward more advanced business intelligence (BI) or data sciences.

<strong>Data grids</strong> are an Excel-like view of the data contained in a SQL database. They give end-users an easy and intuitive way to work on their data in a tabular format.

<hr />

This blog post explains how to visualize data stored in a MySQL database by building a web application with forms, charts, dashboards, and data grids using Five's low-code IDE.
<div style="background-color: #001524;">

<hr style="height: 5px;" />

</div>
<h3>What is Five?</h3>
Five helps software developers rapidly build and deploy online database applications on a MySQL database.

<a href="https://five.co/rapidly-build-powerful-custom-business-applications-a-developers-guide/" target="_blank" rel="noopener noreferrer">Typical applications built with Five are operations software or business applications</a> designed to store, update, process, analyze or visualize data stored in a MySQL database.

Applications built with Five are responsive and can be accessed from any device. Through Five's in-built authentication features or Single-Sign-On (SSO), developers can govern application access and permissions, making sure that data is only exposed or accessible to selected user groups.
<h2>Using Five For SQL Visualizations &amp; Data Processing</h2>
Five's low-code IDE lets anyone familiar with SQL create insightful and information-rich decision support systems and SQL reporting tools on a MySQL database.

Five offers several ways to store, process and visualize data:
<ol>
 	<li><strong>Create and Manage a MySQL Database.
</strong>Inside Five, developers can visually create a cloud-hosted MySQL database, and its tables, fields, and relationships. Instead of having to connect to an external MySQL database, every application developed with Five comes with an integrated MySQL database that developers can create and manage using Five's table wizard or database modeler.</li>
 	<li><strong>Build or Write SQL Queries using Five's Query Editor.
</strong>Inside Five, developers can query the data stored in their MySQL database. Five lets developers build and write queries using Five's visual SQL editor. Data from queries can be served to the front end in <a href="https://five.co/webhooks-explained/">real time through Five's use of Webhooks</a>.</li>
 	<li><strong>Create Charts.
</strong>Inside Five, developers can select from a library of out-of-the-box charts for MySQL data visualization. Five's chart library includes the most common chart types, such as bar, line, or radar charts.</li>
 	<li><strong>Combine Charts and Reports into Dashboards.</strong>
Developers can define a UI grid to place charts and reports to build custom dashboards.</li>
 	<li><strong>Filter and Query Data as Data Consumers.
</strong>End-users who consume the data through the finished application can search and filter their data. Five provides pre-built features for end-users to do so. Five also lets end-users export data to CSV.</li>
</ol>
<h3>How is Five Different From Pure-Breed Data Visualization Tools?</h3>
Typical data visualization or business intelligence tools, such as Microsoft PowerBI or Tableau only consume data from data sources. They are solely used to create dashboards or read-only data visualizations. These tools are <em>not </em>designed to store, process, or update data, for example. Nor can they incorporate business logic, such as functions, processes or notifications.

Five, on the other hand, is a low-code development environment for creating feature-rich web applications. Applications built with Five come with a MySQL Database, and can contain forms, dashboards, in-app notifications, or multiple user roles and permissions. SQL dashboards and visualizations are but one of Five's application development features.

In an application built with Five, end-users can be assigned Create, Read, Update, and Delete (CRUD) permissions.

To use a simple example: say, you want to build a lead-generation web application with the following functionality:
<ol>
 	<li>Consumers can sign up for your services using a form that is accessible on a public URL.</li>
 	<li>Your sales team gets notified by email every time someone signs up and can process consumers' information inside the same application.</li>
 	<li>Management has a dashboard that tracks daily sign-ups in real time.</li>
</ol>
This entire application can be developed with Five. Other systems that can be built with Five include inventory management systems, product management systems, or real estate applications, for example.
<h3>How is Five Different From React Data Grid?</h3>
The React data grid is a popular choice by developers to give users an editable view of their data.

Five's data grid comes with the same controls that you would expect from the React Data Grid, such as
<ol>
 	<li>Custom sorting</li>
 	<li>Editing</li>
 	<li>Create - Read - Update - Delete (CRUD) data from inside the grid</li>
 	<li>Pinning a column to the left or right</li>
 	<li>Hiding columns</li>
 	<li>Using different display types natively inside the data grid, such as date or time pickers</li>
 	<li>Adding functions and events into the grid, such as a calculation that is automatically performed when a user enters a cell of the grid.</li>
</ol>
The difference between Five and React's data grid is that the data grid is just one of Five's development features - on top of all its other features, such as
<ul>
 	<li>a cloud-hosted MySQL database,</li>
 	<li>development, testing, and production environments,</li>
 	<li>a JavaScript &amp; TypeScript code editor, as well as many others.</li>
</ul>

<hr />

<h2>Using Five to Analyze and Visualize MySQL Data</h2>
Let's explore Five's data visualization and reporting features to analyze data and create SQL business intelligence. We will focus on four of Five's features:
<ol>
 	<li>Forms, drill-downs, and Filters</li>
 	<li>Reports &amp; Charts</li>
 	<li>Dashboards</li>
 	<li>Data Grids</li>
</ol>
We are using Five's Portfolio application to demonstrate these features. To follow along:
<ol>
 	<li><a href="https://five.co/sign-up" target="_blank" rel="noopener">Sign up</a> and download Five for free from our website, and</li>
 	<li><a href="https://help.five.org/2.1/docs/getting-started/quick-start-guide/import-a-five-defintion-file" target="_blank" rel="noopener noreferrer">Import the Portfolio application</a>.</li>
</ol>
To understand the Portfolio application, let's first analyze its Entity Relationship Diagram (ERD).

We will primarily work with two tables in this diagram: the Portfolio and the Buy table. For now, simply note that a portfolio can have several buy transactions. Also note, that the application's database was created using Five's table wizard and visual database modeler.

<img class="aligncenter" src="https://help.five.org/2.1/img/learning-resources/portfolio/intermediate/build-database-tables/navigate/portfolio-stage-two-model.png" alt="Five.Co - Portfolio Database Diagram" width="778" height="759" />
<h3>1. Forms and Filters</h3>
As just mentioned, note how the <strong>Portfolio </strong>table has a one-to-many relationship to the <strong>Buy</strong> table in our ERD. Let's explore this relationship in our end-user application.

Forms, drill-downs, and filters are Five's most basic building blocks for your end-users to interact with your database.

To explore Five's user interface and how it displays forms, drill-downs, and filters, follow these steps:
<ol>
 	<li>Launch the Portfolio Application.</li>
 	<li>Click on <strong>Portfolios </strong>&gt; <strong>Growth Portfolio &gt; Down Arrow. </strong>You have just drilled down into your Growth Portfolio. Note how in the top navigation bar, your end-users can now see the drill-down: <strong>Home &gt; Portfolios (Growth Portfolio) &gt; Buys. </strong></li>
 	<li>Click on <strong>Buys </strong>to see the buy transactions that are related to your portfolio. Click on any of the buy transactions, let's say <strong>BHP. </strong>The form on the right now displays all information that pertains to this buy transaction.</li>
 	<li>To filter your data, click on the <strong>Filter </strong>icon inside the search bar. Five lets you filter your data based on multiple dimensions.</li>
 	<li>Of course, you can also perform simple text searches using the <strong>Search Bar. </strong></li>
</ol>
To see these features in action, check out this video:
{% embed 
https://youtu.be/1U4RTOm_mDc
 %}<h3>2. Reports &amp; Charts</h3>
Now let's look at reports and charts. Again, we will be looking at the portfolio application.

<img class="aligncenter size-full wp-image-958" src="https://five.co/wp-content/uploads/2023/05/Five.Co-Charts-Reports.png" alt="Five.Co - Charts &amp; Reports" width="1280" height="720" />
<ol>
 	<li>Launch the Portfolio Application,</li>
 	<li>Click on <strong>Daily Volume</strong> in the menu on the left. The <strong>Daily Volume </strong>shows a line chart at the top and a report at the bottom.</li>
 	<li>Note how by using the <strong>Filter </strong>icon, your end-users can filter the report at the bottom.</li>
</ol>
Five lets developers write SQL queries during the application development to build reports and charts in your end-users' application. Follow a step-by-step guide to build the line chart and report by visiting our <a href="https://help.five.org/2.1/docs/getting-started/quick-start-guide/filter-data-in-a-report" target="_blank" rel="noopener noreferrer">Quick Start Guide</a>.
<h3>3. SQL Dashboards</h3>
When we looked at the report and chart just now, we saw both were displayed on the same page. This is what Five calls a dashboard: a single page that combines different pieces of data.

The <strong>Daily Volume </strong>dashboard has one column and two rows. Inside of Five, we can define a custom grid for our dashboard and position charts or reports as per end-users' requirements in this grid.

Here is another example of a dashboard built with Five. Here our developers built a dashboard with two columns and two rows. We used a radar and a bar chart in the upper row. In the lower row, we only placed one report. And, of course, we created a cool dark theme for this particular dashboard.

<img class="aligncenter size-full wp-image-959" src="https://five.co/wp-content/uploads/2023/05/Five.Co-SQL-Dashboard.png" alt="Five.Co - SQL Dashboard" width="1280" height="720" />
<h3>4. Data Grids</h3>
The data grid is one of Five's most powerful data visualization tools. A data grid shows all data contained in a database table. It gives end-users an Excel-like view of their data inside an editable grid.

The data grid is a frequently-asked-for feature request by application end users. Popular design libraries such as React and Material-UI offer Data Grids as a UI component.

In Five, developers can create a data grid as a page inside a form. No custom code is required to add data grids to your forms.

To understand how a data grid looks to the application's end-users, watch the video below. In it, we have developed a simple two-table application that shows members by location. For each location, we can view all its members in a data grid.

{% embed https://youtu.be/PM76Pn2Vab4
 %}
Data grids are typically used to perform quick sanity tests on data. Instead of having to click through forms, the data stored in your SQL database is shown straight on the end-user's front end, the same way they would see it if it were stored in a spreadsheet.

To learn how to build a data grid, <a href="https://www.five.org/t/can-i-create-an-excel-like-view-onto-my-data-inside-my-app/160/2" target="_blank" rel="noopener">visit our user community</a> and follow the steps.
<h2>Conclusion: SQL Dashboards &amp; Data Visualization</h2>
This blog post gives a quick introduction to some of Five's MySQL data visualization and business intelligence features. Five can be used as a powerful SQL reporting tool and comes with many useful SQL dashboards and in-built visualization features. Moreover, Five also lets developers build use powerful SQL data validation techniques to ensure data is <a href="https://five.co/powerful-sql-data-validation-techniques/">stored in a clean and consistent manner</a>.

Starting from simple forms that can be filtered or searched by application users, we explored
<ul>
 	<li>charts,</li>
 	<li>reports</li>
 	<li>dashboards, and</li>
 	<li>Five's editable data grid.</li>
</ul>
Everything shown in this article is fully developed in Five, using Five's pre-built features as well as a few lines of standard SQL.

Beyond application development, Five also offers one-click deployment features. Developers can build and test their applications locally by using Five's free download. To launch applications to Five's managed cloud, sign up for a paid subscription on our website.

To start building, <a href="https://five.co/sign-up">sign up here</a>.