Building a Sales Analytics Dashboard on Azure PostgreSQL + Azure Data Studio



This content originally appeared on DEV Community and was authored by Abiola Omiyale

In this post, I’ll walk you through how I deployed my Sales Analytics Project to an Azure PostgreSQL database, queried it using SQL, and visualized insights directly in Azure Data Studio. If you’re just getting started with databases and want a real-world project to practice with, this one’s for you.

Project Repo

GitHub Repository: Sales Analytics

This SQL-only project simulates a retail store’s backend — with tables like:

  • products
  • customers
  • sales
  • store
  • staff

We perform analysis to answer questions like:

  • What are the most bought items?
  • Which regions bring in the most revenue?
  • Who are our top customers?

Skills You’ll Practice

  • PostgreSQL (SQL Queries)
  • Azure Database for PostgreSQL
  • Azure Data Studio Visualizations
  • Connecting to cloud databases from your local machine

Step 1: Set Up Azure PostgreSQL

  1. Login to Azure Portal
  2. Search for “Azure Database for PostgreSQL”
  3. Choose Single server (or Flexible Server for modern features)
  4. Fill in the details:
    • Server name
    • Region
    • Admin username and password
  5. Allow public access (for now):
    • Go to Networking > Firewall rules
    • Add your current IP address
  6. Click Create and wait for deployment

Step 2: Clone the GitHub Repository

git clone https://github.com/Gydera/Sales-Analytics.git
cd Sales-Analytics

📁 Inside This Repository

  • schema.sql: Creates tables
  • seed_data.sql: Inserts mock data
  • queries.sql: The analytics query

Step 3: Connect Azure PostgreSQL to Azure Data Studio

  1. Open Azure Data Studio

  2. Install PostgreSQL Extension

    • Go to the Extensions view (left sidebar or Ctrl+Shift+X)
    • Search for PostgreSQL
    • Click Install
  3. Set Up a New Connection

    • Click on New Connection
    • Fill in the connection fields:
      • Server name: your-server-name.postgres.database.azure.com
      • Authentication Type: Username / Password
      • Username: your-admin-username@your-server-name
      • Password: your-password
      • Database Name: postgres or your custom database
      • Server Group: Optional, for organization
    • Click Connect

Step 4: Create Tables and Load Sample Data

  1. Create a New Database (Optional)

You can use the default postgres database or create a new one:
sql
CREATE DATABASE sales_analytics;

Switch to the New Database

  1. Open Azure Data Studio.
  2. In the SQL editor, click the database dropdown near the top toolbar.
  3. Select your new database: sales_analytics.

Run the Table Schema Script

  1. Open the schema.sql file from your local project folder.
  2. Copy and paste the content into a new SQL editor window in Azure Data Studio.
  3. Click Run (F5 or the ▶ button) to execute all commands and create your tables.

Insert Seed Data

  1. Open the seed_data.sql file from your project.
  2. Paste it into the SQL editor or open the file directly.
  3. Click Run to execute all the insert queries and populate your tables with mock data.

📊 Step 5: Query and Visualize Your Data

You’re now ready to start analyzing the data using SQL queries!

Example Query: Top 10 Most Purchased Products

sql

SELECT product_name, COUNT(*) AS total_sold
FROM sales
JOIN products ON sales.product_id = products.product_id
GROUP BY product_name
ORDER BY total_sold DESC
LIMIT 10;

📈 Create a Chart in Azure Data Studio

  1. Run the query from above.

  2. Highlight the result table

    Click and drag across the result rows, or select a single cell.

  3. In the bottom-right corner of the results pane, click the Chart icon 📊.

  4. Choose your preferred visualization type:

    • Bar
    • Pie
    • Line
    • Table
    • Others
  5. Customize the chart:

    • Add a title
    • Label your X and Y axes
    • Toggle data labels for clarity
  6. Export the chart

    Click the camera icon 📸 to export the chart as an image — perfect for use in reports, presentations, or documentation.

🔗 Useful Links


This content originally appeared on DEV Community and was authored by Abiola Omiyale