- Project Overview
- What I practiced
- Database Structure
- Data Cleaning Tasks
- Client Questions Answered
- Key Learnings
This project simulates a small business tracking customer orders. I tracked the order flow for a company using only SELECT and WHERE statements to practice applying theory to real-world tasks.
The goal was:
- Build confidence writing SQL independently
- Learn how to think like an analyst
- Practice data cleaning and querying with limited tools.
- Use simple SQL to answer “client-style” questions.
This project helped me master:
- Creating tables using CREATE TABLE
- Inserting values using INSERT INTO
- Cleaning inconsistent entries using only SELECT + WHERE
- Using REPLACE, CASE, and filtering logic
- Handling NULL values
- Writing queries to answer business questions.
- Calculating date differences with DATEDIFF
The ORDERS table contains: Order_id, price, status, item, delivery_city, customer_name, order_date, delivery_date.
All cleaning was done using SELECT + WHERE only. I Cleaned:
-
Inconsistent city names (lagos, Lagos, ABUJA, abj)
-
Status variations (Pending, pending, Delivered, delivered)
-
NULL values in amount and delivery date
-
Conditional replacements using CASE Example cleaning snippet: SELECT order_id, item, status, delivery_city, customer_name, price, order_date, delivery_date,
CASE WHEN LOWER(delivery_city) = 'lagos' THEN 'Lagos' WHEN LOWER(delivery_city) IN ('abuja', 'abj') THEN 'Abuja' ELSE delivery_city END AS cleaned_city, CASE WHEN LOWER(status) = 'delivered' THEN 'Delivered' WHEN LOWER(status) = 'pending' THEN 'Pending' ELSE status END AS cleaned_status, REPLACE(item, '_', ' ') AS cleaned_item FROM orders;
Some of the business questions solved:
Q1: Find all orders delivered late (delivery took more than 4 days).
Q2: Find all orders that were not delivered (delivery date is NULL).
Q3: List all orders from Lagos (case-insensitive).
Q4: Find all orders where the price is missing or not a valid number.
Q5: Retrieve all orders for “Power Bank” items (take note of inconsistent naming).
Example query: SELECT * FROM [dbo].[ORDERS] WHERE DATEDIFF(DAY, order_date, delivery_date) > 4;
- SQL is easier when approached with real-life scenarios.
- SELECT + WHERE alone can solve a surprising number of problems.
- Small projects build confidence faster than long tutorials