Menu

1 / 3

Retail Sales and Customer Intelligence using Postgresql.

DEV Community: database·Expert Writer·about 14 hours ago
#pyF8mGau
#devtodatabase#devto#dev#customers#profit
Reading 0:00
15s threshold

Introduction

This article entails a SQL analysis of Duka Smart Electronics, a Kenyan electronics retailer trading since January 2025. The project sets up a Postgresql database, loads 150 customers and 800 orders, answers 46 business questions in SQL, and turns the results into insights and a Power BI dashboard.

Objectives of the Project

Creates the retail_analytics database with two related tables, customers and orders

Answers 46 business questions in SQL, from basic filters to window functions, views, and a function

Explains what the results mean for management in insights.md

Data in Tables

The tables were created and had data as follows:

customers (150 rows)

Column Type Meaning

customer_id integer, primary key Unique customer number

customer_name varchar(100), not null Full name

gender varchar(10) Male or Female

city varchar(50) One of ten Kenyan towns

registration_date date When the customer joined

customer_segment varchar(20) Retail, Corporate or VIP

orders (800 rows)

Column Type…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.