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
- Login to Azure Portal
- Search for “Azure Database for PostgreSQL”
- Choose Single server (or Flexible Server for modern features)
- Fill in the details:
- Server name
- Region
- Admin username and password
- Allow public access (for now):
- Go to Networking > Firewall rules
- Add your current IP address
- 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
-
Open Azure Data Studio
- If you don’t have it, download from https://learn.microsoft.com/en-us/sql/azure-data-studio/
-
Install PostgreSQL Extension
- Go to the Extensions view (left sidebar or
Ctrl+Shift+X
) - Search for PostgreSQL
- Click Install
- Go to the Extensions view (left sidebar or
-
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
-
Server name:
- Click Connect
- Click on
Step 4: Create Tables and Load Sample Data
- 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
- Open Azure Data Studio.
- In the SQL editor, click the database dropdown near the top toolbar.
- Select your new database:
sales_analytics
.
Run the Table Schema Script
- Open the
schema.sql
file from your local project folder. - Copy and paste the content into a new SQL editor window in Azure Data Studio.
- Click Run (
F5
or thebutton) to execute all commands and create your tables.
Insert Seed Data
- Open the
seed_data.sql
file from your project. - Paste it into the SQL editor or open the file directly.
- 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
Run the query from above.
Highlight the result table
Click and drag across the result rows, or select a single cell.In the bottom-right corner of the results pane, click the Chart icon
.
-
Choose your preferred visualization type:
- Bar
- Pie
- Line
- Table
- Others
-
Customize the chart:
- Add a title
- Label your X and Y axes
- Toggle data labels for clarity
Export the chart
Click the camera iconto 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