<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by damilola on Medium]]></title>
        <description><![CDATA[Stories by damilola on Medium]]></description>
        <link>https://medium.com/@damiloyebanji?source=rss-00c21abe91b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*XrR4e-QY8SoEfoJBWt9uPQ.jpeg</url>
            <title>Stories by damilola on Medium</title>
            <link>https://medium.com/@damiloyebanji?source=rss-00c21abe91b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 21:47:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@damiloyebanji/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DeltaMart Retail Sales and Customer Analysis: Cleaning, Modeling, and Reporting on Twelve Months of…]]></title>
            <link>https://medium.com/@damiloyebanji/deltamart-retail-sales-and-customer-analysis-cleaning-modeling-and-reporting-on-twelve-months-of-dc14ba936450?source=rss-00c21abe91b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc14ba936450</guid>
            <dc:creator><![CDATA[damilola]]></dc:creator>
            <pubDate>Sat, 22 Aug 2026 11:38:08 GMT</pubDate>
            <atom:updated>2026-08-22T11:38:08.030Z</atom:updated>
            <content:encoded><![CDATA[<h3>DeltaMart Retail Sales and Customer Analysis: Cleaning, Modeling, and Reporting on Twelve Months of Point of Sale Data for a Nigerian Retail Chain.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-S6Z2DDVsrPED4YfOGbCw.png" /></figure><h4><strong>Executive Summary</strong></h4><p>I was given three raw exports from DeltaMart Retail Ltd, a retail chain with twelve branches across Nigeria: a Customers file, a Products file, and an Orders file. None of the three were ready to analyze. I opened MySQL Workbench, built a database around them, and spent most of my time simply making the data trustworthy before I ever tried to answer a business question.</p><p>I found duplicate customer, product, and order records. I found blank emails, blank phone numbers, and blank prices. I found city names spelled four different ways, signup dates written in three different formats, negative stock counts, and orders that pointed to customers or products that did not exist in the other tables. I cleaned what I could clean with confidence, and I deleted what I could not honestly repair, such as orders with no date at all.</p><p>Once the tables were in a state I trusted, I wrote SQL to answer DeltaMart’s questions: which city buys the most, which category sells the most, who the top spending customers are, and which payment method dominates. I built a Power BI dashboard on top of that work.</p><p>While writing this report I went back and checked my own numbers against the file I actually exported for analysis, and I found that my dashboard and my exported analytic file do not agree with each other. I am reporting that honestly here rather than hiding it, because catching my own mistakes is part of what this project is meant to teach me. Where the two disagree, this report uses the verified numbers from the exported file I can actually trace, and I flag the dashboard figure separately.</p><p>The report shows what I found. Port Harcourt is DeltaMart’s strongest city by both revenue and order count. Fashion moves the most units, but furniture earns the most revenue per order. Transfers are used more often than any other payment method, but cards bring in more total revenue. And a few of my own earlier findings, including the claim that certain categories are not more popular in certain cities, turned out to be weaker than I first stated once I looked closer.</p><h4><strong>Data Sources</strong></h4><p>I worked from five files for this project.</p><p>• A Business Brief PDF from Mentis Academy describing DeltaMart’s background, the three raw CSV files, and the exact business questions management wanted answered.</p><p>• Three raw CSV exports described in that brief: DeltaMart_Customers_RAW.csv with 53 rows covering CustomerID, Name, Email, Phone, City, and SignupDate; DeltaMart_Products_RAW.csv with 16 rows covering ProductID, ProductName, Category, Price, and StockQuantity; and DeltaMart_Orders_RAW.csv with 121 rows covering OrderID, CustomerID, ProductID, Quantity, OrderDate, and PaymentMethod. I did not upload these raw files alongside this report, but every row count and every issue I describe below comes directly from querying them inside MySQL Workbench.</p><p>• My SQL script, written and run in MySQL Workbench, which contains every cleaning step, every table rebuild, and every query I used to answer DeltaMart’s business questions. The full script is included as a separate file rather than in the body of this report.</p><p>• A single exported CSV, containing 116 rows, one per order, joined against the cleaned Customers and Products tables and already carrying an OrderTotal column. This is the file I treat as my source of truth for every number in this report, because I can open it and verify it directly.</p><p>• A screenshot of my Power BI dashboard, built from this same database connection, which I describe further down in this report.</p><p>One honest note before I go further. My exported analytic CSV and my Power BI dashboard do not report the same totals. I explain why later in this report, and I treat the CSV as the file I can actually verify, since I can query it directly, while the dashboard reflects an earlier or different pull that I cannot fully retrace.</p><h4>Data Dictionary</h4><p>I am describing every field in plain text rather than a table, since that is how this report is written throughout.</p><p><strong>Customers</strong></p><p>CustomerID is a whole number that uniquely identifies a customer and became the primary key once duplicates were removed. FirstName and LastName are text fields holding the customer’s given and family name. Email is a text field that held blanks in the raw file, which I replaced with the placeholder Not Provided rather than leaving empty. Phone is a text field that also held blanks in the raw file, and I flag later in this report that I found this issue but never actually fixed it. City is a text field that originally held inconsistent spelling and casing across all eight branch cities, which I standardized during cleaning, though one city was missed, which I also explain later in this report. SignupDate was originally free text in three different date formats and is now a proper DATE column.</p><p><strong>Products</strong></p><p>ProductID is a whole number that uniquely identifies a product and became the primary key once one duplicate row was removed. ProductName is a text field naming the item, for example Blender 1.5L or Office Chair. Category is a text field that originally had inconsistent casing across six categories, Groceries, Household, Electronics, Baby Care, Fashion and Furniture, which I standardized. Price is a decimal field that had two products with a missing value, which I manually filled using known list prices. StockQuantity is a whole number that had negative values in the raw file, which I corrected using an absolute value conversion.</p><p><strong>Orders</strong></p><p>OrderID is a whole number that uniquely identifies an order and became the primary key once duplicates and unusable rows were removed. CustomerID and ProductID are whole numbers that link back to the Customers and Products tables and became foreign keys once every orphaned reference was removed. Quantity is a whole number that had negative values in the raw file, which I corrected using an absolute value conversion. OrderDate was originally free text in three different date formats, with some rows completely blank, and is now a proper DATE column with the blank rows removed entirely rather than guessed at. PaymentMethod is a text field that originally had inconsistent casing across three methods, Card, Cash and Transfer, which I standardized.</p><p>Exported analytic file</p><p>The 116 row CSV I use throughout this report joins the three cleaned tables together and adds two calculated fields. OrderTotal is Quantity multiplied by Price for that order, and it is zero on the eleven rows where Price was still blank at the time of this particular export, an issue I describe fully later in this report. City in this file still carries two casing variants, Port Harcourt written two ways and Enugu written two ways, which tells me the city standardization step in my script did not fully make it into this export.</p><h4><strong>Data Cleaning Process and Preprocessing</strong></h4><p>I want to walk through this the way it actually happened, not the tidy version. I started every table the same way, by looking at it before I touched it. I ran select statements and describe statements on all three raw tables so I knew the column names, the data types, and roughly how dirty each one was before I wrote a single fix.</p><p>Customers</p><p>I started with 53 raw rows. A group by on CustomerID with a having count greater than one turned up three duplicate customer IDs. I rebuilt the table using select distinct into a new customers_clean table, dropped the old table, and renamed the clean copy back to customers. That is a pattern I repeated for every table in this project, rebuild clean, drop dirty, rename back.</p><p>I then went looking for blanks. Email was blank on three rows, and I set those to the placeholder Not Provided rather than guessing at a real address. Phone was blank on two rows, and here I have to be honest with myself, I found this issue, wrote the select statement that surfaces it, and then never wrote the update to actually fix it. It is still sitting in my script as a discovered but unresolved issue, and I list it again in the limitations part of this report.</p><p>City was the messiest column in this table. I ran a select distinct on city and saw the same eight branch cities spelled in different cases and with extra whitespace. I trimmed the column first, then wrote individual update statements matching on the upper case version of each spelling, for Abuja, Benin City, Ibadan, Kaduna, Lagos, and Port Harcourt, including catching both PH and PORTHARCOURT as Port Harcourt. When I reviewed my own script for this report I noticed something I had missed at the time, Enugu never got its own update statement. That single missing line is the exact reason Enugu still appears as two different values in my exported analytic file, which I flag again later in this report.</p><p>SignupDate took me two attempts. My first pass converted the three date formats I saw, plain ISO dates, day slash month slash year, and day dot month dot year, into a new SignupDateClean column using STR_TO_DATE with a different format mask for each pattern, matched using a like pattern on the underscores. I then dropped the old text column and renamed the clean one into place. On review I was not confident every row had converted correctly, so I pulled the raw SignupDate values back in from a reimported copy of the table, added a second raw column, and reran the same three conversions against that raw copy before dropping the temporary columns and the temporary import table. I am including that redo in this report rather than editing it out, because catching and correcting my own conversion was part of the actual work, not a mistake to hide. Once I trusted the table, I added a primary key on CustomerID.</p><p>Products</p><p>I started with 16 raw rows and one exact duplicate, which I removed the same way, rebuild with select distinct, drop, rename. That took the table to 15 rows, which matches the product count on both my dashboard and my exported file.</p><p>Two products had a blank price, Bar Soap Pack and Blender 1.5L. There was no way to derive a missing price from the rest of the row, so I looked up the known list prices and entered them manually, 2500 for Bar Soap Pack and 27500 for Blender 1.5L. I want to flag something I only caught while writing this report. Those two products are exactly the ones that still show a blank price on eleven rows in my exported order level file. I go through what that means later in this report, but the short version is that my price fix on the Products table does not appear to have been in place at the time I generated the order level export I am using for this analysis.</p><p>StockQuantity had negative values on some rows, a data entry error since stock cannot be negative. I corrected these using ABS rather than deleting the rows, since the underlying quantity was still usable information, just recorded with the wrong sign.</p><p>Category had the same casing problem as City. I standardized all six categories, Groceries, Household, Electronics, Baby Care, Fashion and Furniture, and then added a primary key on ProductID.</p><p>Orders</p><p>I started with 121 raw rows. I removed one exact duplicate the same way as the other tables. I then looked for missing OrderDate values. Unlike a missing price, I did not feel I could responsibly invent a missing order date, so I deleted those rows outright rather than guess.</p><p>Quantity had negative values, which I corrected with ABS, the same fix I used on StockQuantity. I then checked for orphaned rows, orders whose CustomerID or ProductID did not exist anywhere in the cleaned Customers or Products tables. These are orders that can never be joined correctly and would silently break any report built on top of them, so I deleted them rather than keep them. Between the duplicate, the missing dates, and the orphaned references, the table went from 121 rows down to 116, which is the row count in my final exported analytic file.</p><p>PaymentMethod had the same casing issue as City and Category, and I standardized it down to Card, Cash and Transfer. OrderDate needed the same three format conversion I used on SignupDate, ISO, slash, and dot formatted dates, each parsed with its own STR_TO_DATE mask.</p><p>Once every CustomerID and ProductID in the table pointed to a real row, I added a primary key on OrderID and two foreign keys, one linking CustomerID back to Customers and one linking ProductID back to Products. That is the point where I actually trusted the three tables enough to start answering DeltaMart’s business questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*IGEPDMxc2k67fLg4yof7Cw.png" /></figure><h4><strong>Key Metrics and KPI</strong></h4><p>These numbers are calculated directly from my 116 row exported analytic file, not copied from my dashboard, so I can trace every one of them back to a specific column.</p><p>• Total orders after cleaning: 116.</p><p>• Unique products sold across all orders: 15, matching the full cleaned Products table.</p><p>• Unique customers who placed at least one order: 45. I want to be precise about what this number is and is not. It is the count of distinct customers appearing in the orders file, not necessarily the full size of the cleaned Customers table, since a customer could exist in that table with zero orders and I would not see them here. I do not have a verified total customer count to report, and I explain why later in this report rather than guess at one.</p><p>• Verified total revenue: 6,826,300 naira. This is the sum of OrderTotal across all 116 rows in my exported file.</p><p>• Dashboard reported total revenue: 8,201,300 naira. This is what my Power BI dashboard displays, and it does not match the figure above. I address this gap directly later in this report, since I was not able to fully reconcile it while writing this report.</p><p>• Average order value: 58,847 naira, calculated across all 116 orders including the eleven that currently total zero because of the missing price issue.</p><ul><li>Orders affected by the missing price issue: 11 out of 116, or about 9.5 percent of all orders, all tied to just two products, Bar Soap Pack and Blender 1.5L.</li></ul><h4><strong>EDA</strong></h4><p>Before I tried to answer any business question, I spent time just looking at the shape of the cleaned data.</p><p>Orders spread across three calendar years, 34 orders in 2024, 44 in 2025, and 38 in 2026. While checking this I noticed something worth flagging rather than quietly ignoring. Fourteen of those 116 orders carry a date later than today, August 22, 2026, with the latest dated December 29, 2026. I do not know exactly when this dataset was exported from DeltaMart’s systems, so I am not calling this an error, but it is worth someone at DeltaMart confirming, since future dated orders are unusual in a point of sale export.</p><p>By category, Fashion had the highest unit volume at 115 units sold, followed by Electronics at 107, Groceries at 81, Household at 53, Baby Care at 39, and Furniture last at 35 units. That ordering flips almost completely when I look at revenue instead of units, which is the first sign that unit volume and revenue tell two different stories in this dataset, and I return to that shortly.</p><p>By payment method, Transfer was used on 48 orders, Card on 37, and Cash on 31, out of 116 total. That is 41.4 percent Transfer, 31.9 percent Card, and 26.7 percent Cash by order count.</p><p>By city, once I merge the casing duplicates myself for this exploration, Port Harcourt leads on order count with 28, followed by Ibadan with 20, Abuja with 18, Benin City and Kaduna tied at 14, Enugu and Lagos tied at 9, and Kano lowest at 4.</p><h4><strong>Detailed Analysis Process</strong></h4><p>Every business answer in this report comes from joining the three cleaned tables together and then grouping the result. My core query joins Orders to Customers on CustomerID and to Products on ProductID, calculating OrderTotal as Quantity multiplied by Price on the fly for every row. That single joined result set is the foundation everything else in this report is built on, including the CSV I export and treat as my source of truth.</p><p>From there I used group by with sum to get revenue by city and revenue and units by category, group by with count to get orders by payment method and customers by city, and order by to sort every result from highest to lowest so the biggest number is always the first thing I see. For the top customer question I grouped by CustomerID together with first and last name, summed OrderTotal per customer, sorted descending, and used limit 5 to keep only the top five rows.</p><p>I did not stop at the aggregate SQL results. While preparing this report I pulled the same 116 row export into Python so I could check my own SQL output against an independent calculation, which is how I caught the revenue mismatch, the Enugu casing gap, and the first name ambiguity described later in this report. I think that cross check was one of the more useful parts of this project, since it is what surfaced the issues a dashboard alone would have let me miss.</p><h4><strong>Key Findings and Insight (Facts, Insight)</strong></h4><p>I am separating what I can state as a direct fact from the query results from what requires me to interpret those results because I do not want to overstate either one.</p><p>Facts</p><p>• Port Harcourt is DeltaMart’s strongest city by every measure I have, 2,338,800 naira in revenue, 28 orders, and 9 distinct customers, all the highest of any city once I merge its two casing variants.</p><p>• Fashion sold the most units at 115, but Furniture earned the most revenue at 2,275,000 naira despite selling only 35 units.</p><p>• Transfer was used on more orders than any other payment method, 48 out of 116, but Card generated the most total revenue at 2,630,900 naira despite being used on fewer orders, 37.</p><p>• My verified top five customers by total spend are Ifeoma Olawale at 558,500 naira, Rukayya Bello at 524,500 naira, Tunde Nwosu at 426,200 naira, Bisi Danjuma at 362,100 naira, and Musa Suleiman at 347,000 naira.</p><p>Insight</p><p>Furniture earning the most revenue while selling the fewest units is not, by itself, evidence that furniture is DeltaMart’s most profitable category. Profit requires knowing what each item cost DeltaMart to buy or make, and that cost figure does not exist anywhere in the three tables I was given. I can say Furniture earns the highest revenue per unit sold, and I can say it earns the highest total revenue, but calling it the most profitable category is a claim my earlier findings document made that I cannot actually support with the data I have. I am correcting that here rather than repeating it.</p><p>Similarly, Transfer being the most used payment method and Card generating the most revenue suggests that Card transactions tend to be for higher value purchases, while Transfer gets used more broadly across smaller and larger orders alike. That is a reasonable interpretation of the pattern, but it is an interpretation, not a measured fact, since I have not tested whether that difference is statistically meaningful given the sample size involved.</p><p>The most important insight I found while preparing this report was not really about DeltaMart at all, it was about my own earlier analysis. My original findings document lists the top five customers by first name alone, Tunde, Rukayya, Ifeoma, Ngozi, Musa. When I checked the underlying data properly, I found this is a genuinely risky way to identify a customer. Eleven different first names repeat across two or more distinct people in this dataset, including three separate customers named Tunde and three separate customers named Ngozi. Musa is the clearest example of the problem; it appears as a first name for two different customers, Musa Suleiman and Musa Adeyemi, and separately as a last name for three more, Hauwa Musa, Peter Musa, and Lami Musa. My own Power BI dashboard has a chart literally titled Total Customer by FirstName, which means it is grouping on exactly the field that cannot reliably tell two different customers apart. My verified top five list in this report uses full name and CustomerID grouping, which is why it does not exactly match my earlier first name-based list, and I consider the full name version the more trustworthy one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-S6Z2DDVsrPED4YfOGbCw.png" /></figure><h4><strong>Visualization and Charts</strong></h4><p>My Power BI dashboard is titled DeltaMart’s Dashboard Analysis, covering 2024 to 2026, with a city filter panel down the left side listing all eight branch cities exactly as they appear in the underlying data, including enugu still in lower case, which is visible confirmation of the casing issue I describe elsewhere in this report.</p><p>Across the top sit four headline cards, Total Revenue at 8,201,300 naira, Avg Revenue at 70,700.86 naira, Total Customer at 116, and Total Product at 15. I want to flag two of these cards directly against the numbers I calculated earlier in this report. The Total Revenue card does not match my verified figure of 6,826,300 naira, and the Total Customer card showing 116 is the same number as my total order count, not the 45 unique customers I can actually verify from my exported order level file. I believe this card is pulling from a count of order rows or a differently structured customer measure rather than a true distinct customer count, though I was not able to fully confirm which while writing this report.</p><p>Below the cards, a line chart tracks Total Revenue by Year and Quarter from January 2024 through July 2026, showing a sharp peak around mid 2025. A horizontal bar chart shows Total Revenue by City with Port Harcourt clearly the tallest bar, which does agree directionally with my own city level calculation even though the exact totals differ. Another bar chart shows Total Revenue by Category with Furniture, Electronics, Fashion and Groceries as the four largest bars. A donut chart shows Total Revenue by PaymentMethod at 39.42 percent Transfer, 33.42 percent Card, and 27.16 percent Cash, which is close in shape to my own order count based percentages of 41.4, 31.9 and 26.7 percent, though not identical, again consistent with the two files being slightly different snapshots of the same underlying work.</p><p>On the right side of the dashboard, a bar chart titled Total Customer by FirstName lists Tunde, Rukayya, Ngozi, Musa, Precious, Yusuf and Tolu. As I explained earlier, I now consider this specific chart the clearest visual evidence of the first name ambiguity problem in this project, since several of those names represent more than one real person.</p><h4><strong>Statistical Analysis Result</strong></h4><p>I want to be upfront that this project sits in descriptive analytics, not inferential statistics. Every number in this report so far is a count, a sum, or an average, which describes what happened in this specific dataset. None of it is a statistical test that tells me whether a pattern I am seeing would hold up in a larger dataset or is just noise from a relatively small sample.</p><p>That matters most for the last two questions in the original business brief, whether there is a relationship between city and the products customers buy, and whether certain categories are more popular in certain cities. My earlier findings document answered both questions with a flat No. Having now cross tabulated city against category myself, I do not think No is an accurate answer, and I also do not think I have the evidence to properly confirm a Yes.</p><p>When I count orders by city and category together, Fashion shows up as the top or near top category in Port Harcourt, Ibadan, Lagos and Abuja alike, which looks broad rather than city specific. Electronics, on the other hand, clusters more heavily in Abuja and Kaduna, each with seven orders, which looks more concentrated. That is a real pattern in the counts I pulled, but every one of these city and category combinations involves single digit order counts, several as low as four or five. With numbers that small, I do not have the statistical power to say with any confidence that this pattern is a genuine relationship rather than random variation. A proper answer to this question would need a chi square test of independence or a similar method, run once DeltaMart has enough order volume per city and category combination for that test to mean something. I have not run that test here, and I would rather say that clearly than present a pattern I noticed in a spreadsheet as a statistically confirmed relationship.</p><h4>Limitations and Assumptions</h4><p>I am listing every limitation I am aware of rather than only the flattering ones, since I would rather this report be useful than impressive.</p><p>• My dashboard’s total revenue, 8,201,300 naira, and my own verified calculation from the exported analytic file, 6,826,300 naira, do not agree, and I was not able to fully reconcile the gap while writing this report. Part of the difference is explained by the eleven zero value orders in my export, but not all of it, since eleven orders at the dataset’s average value would only account for roughly 647,000 naira, well short of the full 1,374,700 naira gap. I am treating this as an open issue rather than pretending it is resolved.</p><p>• My city standardization step never included Enugu, which is why enugu still appears as its own separate value, lower case, in both my exported file and my dashboard’s city filter list.</p><p>• I manually fixed the missing price for Bar Soap Pack and Blender 1.5L in the Products table, but eleven order level rows tied to exactly those two products still show a blank price and a zero OrderTotal in my exported analytic file. My fix does not appear to have been in place at the time that particular export was generated.</p><p>• I identified two blank phone numbers in the Customers table during cleaning but never actually wrote the update statement to fix them. The issue is documented in my script but not resolved.</p><p>• I cannot confirm the true total number of customers in the cleaned Customers table. I can only confirm 45 unique customers who placed at least one order, since that is all my order level export can show me. A customer with zero orders would not appear in that count.</p><p>• No cost or margin data exists anywhere in the three source tables, so every profitability style claim in my earlier findings document is unsupported. I can only speak to revenue, never true profit.</p><p>• First name is not a reliable way to identify a unique customer in this dataset. Eleven first names are shared by two or more distinct people, and my dashboard’s Total Customer by FirstName chart inherits that same weakness.</p><p>• Fourteen orders carry a date after August 22, 2026, today’s date, with the latest at December 29, 2026. I cannot confirm whether this reflects the actual export timing or is itself a data quality issue, so I am flagging it rather than explaining it away.</p><p>• The overall dataset is small, 116 orders across at most 53 raw customers, which limits how much confidence I can place in any city or category pattern, particularly once the data is broken down into combinations as narrow as city crossed with category.</p><ul><li>No formal statistical test was performed anywhere in this project. Every pattern described earlier in this report is descriptive, not statistically confirmed.</li></ul><h4><strong>Recommendation and Action Items (Facts, Insight)</strong></h4><p>These recommendations follow directly from the facts and insight described earlier in this report, and I have tried to keep each one tied to something I can actually point back to in the data.</p><p>• Reconcile the dashboard and exported file totals before this report or dashboard is shown outside this project, since the two currently disagree on total revenue and total customers, and that gap has not been explained.</p><p>• Add Enugu to the city casing standardization step in the SQL script and rerun the full cleaning pipeline, so every city level report reflects one consistent value per city.</p><p>• Confirm that the price fix for Bar Soap Pack and Blender 1.5L is actually committed in the Products table before the next export, and rerun the order level join afterward, since eleven orders currently understate revenue by recording a zero total.</p><p>• Prioritize Port Harcourt for continued marketing and inventory investment, since it leads on revenue, order count and customer count together, though I would validate this against a larger dataset before committing real budget to it.</p><p>• Consider promoting Fashion and Electronics given their high unit volume, while separately testing whether bundling or upselling Furniture, which already earns the highest revenue per unit, can lift its total revenue further.</p><p>• Replace every first name based grouping, including the Total Customer by FirstName chart on the current dashboard, with a grouping based on CustomerID or full name, since first names repeat across distinct customers in this dataset.</p><ul><li>Go back and fix the two blank phone numbers in the Customers table that were identified during cleaning but never actually resolved.</li></ul><h4><strong>Expected Outcomes</strong></h4><p>I built this project to show that I can take a genuinely messy export and turn it into something a business could actually use, not to produce a finished analytics platform for a real company. I expect this report and its dashboard to demonstrate that I can identify data quality problems on my own, fix the ones I can fix with SQL, clearly document the ones I cannot, and communicate the difference between the two honestly to a non technical audience.</p><p>I do not expect every number in this report to be final. I expect the opposite, that writing this report is what surfaced problems, like the revenue mismatch and the first name ambiguity, that a quick glance at the dashboard alone would have let me miss. If this project has a single outcome I care about most, it is that habit of checking my own work rather than trusting the first chart that renders correctly.</p><h4>Codes and Scripts</h4><p>This is my full SQL script exactly as I wrote and ran it in MySQL Workbench.</p><pre>drop database deltamart;<br>create database deltamart;   # first you create the database <br>use deltamart;               -- then you use the database created <br><br>-- Exploratory Data Analysis <br>select * from customers;<br>select * from orders;<br>select * from products; <br><br>-- describe the table to know the structure( column names , data type)<br>describe customers;<br>describe orders;<br>describe products; <br><br>-- To count rows <br>select count(*) as &#39;Total customer&#39; from customers;  -- 53 rows <br>select count(*) as `Total order` from orders;        -- 121 rows<br>select count(*) as `Total Product` from products;    -- 16 rows <br><br>-- Data Cleaning  customer Table <br><br>-- 1. Find duplicate rows <br>     select CustomerID,<br>     count(*) as Occurences <br>     from customers <br>     group by CustomerID<br>     having count(*)&gt; 1;   -- we have three duplicate <br>     <br>-- Remove Duplicate <br>create table customers_clean as select distinct * from customers;<br>drop table customers;<br>rename table customers_clean to customers;<br><br># Find Missing Values <br>select * from customers where Email is null or Email = &#39;&#39;; -- 3 blanks <br>select * from customers  where Phone is null or Phone = &#39;&#39;;  -- 2 blanks <br>select * from customers where City is null or City = &#39;&#39;;     --  no blanks <br>select * from customers where FirstName is null or FirstName = &#39;&#39;; -- no blanks<br><br><br><br>--  handle Missing values. <br>update customers set Email = &#39;Not Provided&#39; where Email is null or Email = &#39;&#39;;  <br>set sql_safe_updates = 0;<br><br>-- check city column <br><br>select distinct city from  customers order by city;<br><br><br>-- handling mispelling problem <br><br>update customers set city = trim(city);<br>update customers set city = &#39;Abuja&#39; where upper(city) = &#39;ABUJA&#39;;<br>update customers set city = &#39;Benin City&#39; where upper(city) = &#39;benin city&#39;;<br>update customers set city = &#39;Ibadan&#39; where upper(city) = &#39;ibadan&#39;;<br>update customers set city = &#39;Kaduna&#39; where upper(city) = &#39;kaduna&#39;;<br>update customers set city = &#39;Lagos&#39; where upper(city) = &#39;LAGOS&#39;;<br>update customers set city = &#39;Port Harcourt&#39; where upper(city) IN (&#39;PH&#39;, &#39;PORTHARCOURT&#39;);<br><br>-- VIEW Signupdate and update SignupDate<br>select distinct SignupDate from customers;<br>ALTER TABLE Customers ADD COLUMN SignupDateClean DATE;<br><br>UPDATE Customers<br>SET SignupDateClean = STR_TO_DATE(SignupDate, &#39;%Y-%m-%d&#39;)<br>WHERE SignupDate LIKE &#39;____-__-__&#39;;<br><br>UPDATE Customers<br>SET SignupDateClean = STR_TO_DATE(SignupDate, &#39;%d/%m/%Y&#39;)<br>WHERE SignupDate LIKE &#39;__/__/____&#39;;<br><br>UPDATE Customers<br>SET SignupDateClean = STR_TO_DATE(SignupDate, &#39;%d.%m.%Y&#39;)<br>WHERE SignupDate LIKE &#39;__.__.____&#39;;                         -- Right After this -------<br><br>-- Swap the clean column in for the messy one (DDL: ALTER TABLE)<br>ALTER TABLE Customers DROP COLUMN SignupDate; -- delete the column command <br>ALTER TABLE Customers CHANGE COLUMN SignupDateClean SignupDate DATE;  -- change column name<br><br>-- ADD Primary Key <br> alter table customers add primary key(CustomerID);<br> describe customers;<br> <br> -- Sanity Check <br> select * from customers order by CustomerID;<br><br><br>-- Pull raw SignupDate back in<br>ALTER TABLE customers ADD COLUMN SignupDateRaw VARCHAR(20);  -- create a new empty text column to hold the raw dates<br><br>UPDATE customers c<br>JOIN `customers.signup` r ON c.CustomerID = r.CustomerID   -- match each customer to their row in the freshly re-imported raw table<br>SET c.SignupDateRaw = r.SignupDate;                          -- copy the original messy date text across<br><br>-- Convert it properly this time<br>ALTER TABLE customers ADD COLUMN SignupDateClean DATE;       -- create a new proper DATE column, still empty for now<br><br>UPDATE customers<br>SET SignupDateClean = STR_TO_DATE(SignupDateRaw, &#39;%Y-%m-%d&#39;) -- parse the ISO-style dates (e.g. 2024-06-09)<br>WHERE SignupDateRaw LIKE &#39;____-__-__&#39;;                        -- only touch rows that actually look like YYYY-MM-DD<br><br>UPDATE customers<br>SET SignupDateClean = STR_TO_DATE(SignupDateRaw, &#39;%d/%m/%Y&#39;) -- parse the slash-style dates (e.g. 09/06/2024)<br>WHERE SignupDateRaw LIKE &#39;__/__/____&#39;;                        -- only touch rows that look like DD/MM/YYYY<br><br>UPDATE customers<br>SET SignupDateClean = STR_TO_DATE(SignupDateRaw, &#39;%d.%m.%Y&#39;) -- parse the dot-style dates (e.g. 09.06.2024)<br>WHERE SignupDateRaw LIKE &#39;__.__.____&#39;;                        -- only touch rows that look like DD.MM.YYYY<br><br>-- Check before cleanup<br>SELECT SignupDateRaw, SignupDateClean FROM customers;         -- eyeball every row side-by-side, make sure nothing is still NULL<br><br>-- Cleanup once confirmed correct<br>ALTER TABLE customers DROP COLUMN SignupDate;                 -- remove the old broken/empty DATE column<br>ALTER TABLE customers DROP COLUMN SignupDateRaw;               -- remove the temporary raw-text column, job done<br>ALTER TABLE customers CHANGE COLUMN SignupDateClean SignupDate DATE;  -- rename the clean column back to SignupDate<br>DROP TABLE `customers.signup`;                                -- delete the temporary import table, no longer needed<br><br><br><br><br><br>-- Remove duplicate <br>-- find the missing order of date <br>-- remove the null in the order of date <br>--  fix the impossible value in quantity because qtty cannot be negative <br>--  check both product and payment and see they are correctly spelt <br><br>-- data cleaning order <br><br><br><br>-- ---------------------------------------------------------------------<br>-- 5.2  PRODUCTS TABLE<br>-- ---------------------------------------------------------------------<br><br>-- Step 1 &amp; 2: Remove the duplicate product row<br>CREATE TABLE Products_Clean AS<br>SELECT DISTINCT * FROM Products;                                    -- build a fresh table keeping only unique rows (drops the exact duplicate)<br><br>DROP TABLE Products;                                                 -- delete the old messy table<br>RENAME TABLE Products_Clean TO Products;                             -- rename the clean copy back to Products<br><br>-- Step 3: Find missing prices<br>SELECT * FROM Products WHERE Price IS NULL or Price = &#39;&#39;;                          -- show which products have no price recorded<br>select * from Products;<br>-- Step 4: Fix missing prices. In a real project you&#39;d confirm these<br>-- with DeltaMart&#39;s inventory team -- here we use the known list price.<br>UPDATE Products SET Price = 2500  WHERE ProductID = 3  AND Price IS NULL; -- Bar Soap Pack -- manually enter the correct known price<br>UPDATE Products SET Price = 27500 WHERE ProductID = 9  AND Price IS NULL; -- Blender 1.5L  -- manually enter the correct known price<br><br>-- Step 5: Fix the impossible value -- stock can&#39;t be negative<br>SELECT * FROM Products WHERE StockQuantity &lt; 0;                      -- find any product with a negative stock count (data entry error)<br>UPDATE Products SET StockQuantity = ABS(StockQuantity) WHERE StockQuantity &lt; 0; -- flip negative numbers to positive using ABS()<br><br>-- Step 6: Standardize Category casing<br>Select distinct category from products;<br>UPDATE Products SET Category = &#39;Groceries&#39;   WHERE UPPER(Category) = &#39;GROCERIES&#39;;   -- catch every casing variant of &quot;Groceries&quot;<br>UPDATE Products SET Category = &#39;Household&#39;   WHERE UPPER(Category) = &#39;HOUSEHOLD&#39;;   -- catch every casing variant of &quot;Household&quot;<br>UPDATE Products SET Category = &#39;Electronics&#39; WHERE UPPER(Category) = &#39;ELECTRONICS&#39;; -- catch every casing variant of &quot;Electronics&quot;<br>UPDATE Products SET Category = &#39;Baby Care&#39;   WHERE UPPER(Category) = &#39;BABY CARE&#39;;   -- catch every casing variant of &quot;Baby Care&quot;<br>UPDATE Products SET Category = &#39;Fashion&#39;     WHERE UPPER(Category) = &#39;FASHION&#39;;     -- catch every casing variant of &quot;Fashion&quot;<br>UPDATE Products SET Category = &#39;Furniture&#39;   WHERE UPPER(Category) = &#39;FURNITURE&#39;;   -- catch every casing variant of &quot;Furniture&quot;<br><br>-- Step 7: Lock in the primary key<br>ALTER TABLE Products ADD PRIMARY KEY (ProductID);                    -- now that duplicates are gone, enforce ProductID uniqueness<br><br>SELECT * FROM Products ORDER BY ProductID;  <br>describe table products;                        -- sanity check: eyeball the fully cleaned table<br><br><br>-- ---------------------------------------------------------------------<br>--  ORDERS TABLE<br>-- ---------------------------------------------------------------------<br><br>-- Step 1 &amp; 2: Remove the exact duplicate order row<br>CREATE TABLE Orders_Clean AS<br>SELECT DISTINCT * FROM Orders;                                       -- build a fresh table keeping only unique rows<br><br>DROP TABLE Orders;                                                    -- delete the old messy table<br>RENAME TABLE Orders_Clean TO Orders;                                  -- rename the clean copy back to Orders<br><br>-- Step 3: Find missing OrderDates<br>SELECT * FROM Orders WHERE OrderDate IS NULL OR OrderDate = &#39;&#39;;       -- show orders with no date recorded<br><br>-- Step 4: We have no reliable way to guess a missing OrderDate, so we<br>-- remove those rows rather than invent a date (DML: DELETE).<br>DELETE FROM Orders WHERE OrderDate IS NULL OR OrderDate = &#39;&#39;;         -- remove rows we can&#39;t fix honestly<br><br>-- Step 5: Fix the impossible value -- quantity can&#39;t be negative<br>SELECT * FROM Orders WHERE Quantity &lt; 0;                              -- find any order with a negative quantity (entry error)<br>UPDATE Orders SET Quantity = ABS(Quantity) WHERE Quantity &lt; 0;        -- flip negative numbers to positive using ABS()<br><br>-- Step 6: Find &quot;orphan&quot; rows -- an Order that points to a Customer or<br>-- Product that doesn&#39;t actually exist (a referential integrity issue)<br>SELECT * FROM Orders WHERE CustomerID NOT IN (SELECT CustomerID FROM Customers); -- orders linked to a customer that isn&#39;t real<br>SELECT * FROM Orders WHERE ProductID  NOT IN (SELECT ProductID  FROM Products);  -- orders linked to a product that isn&#39;t real<br><br>-- These orders can never be matched to a real customer/product, so we<br>-- remove them -- keeping them would break every JOIN we write later.<br>DELETE FROM Orders WHERE CustomerID NOT IN (SELECT CustomerID FROM Customers); -- delete the orphaned customer references<br>DELETE FROM Orders WHERE ProductID  NOT IN (SELECT ProductID  FROM Products);  -- delete the orphaned product references<br><br>-- Step 7: Standardize PaymentMethod casing<br>select distinct paymentmethod from orders;<br>UPDATE Orders SET PaymentMethod = &#39;Card&#39;     WHERE UPPER(PaymentMethod) = &#39;CARD&#39;;     -- catch every casing variant of &quot;Card&quot;<br>UPDATE Orders SET PaymentMethod = &#39;Cash&#39;     WHERE UPPER(PaymentMethod) = &#39;CASH&#39;;     -- catch every casing variant of &quot;Cash&quot;<br>UPDATE Orders SET PaymentMethod = &#39;Transfer&#39; WHERE UPPER(PaymentMethod) = &#39;TRANSFER&#39;; -- catch every casing variant of &quot;Transfer&quot;<br><br>-- Step 8: Convert OrderDate from messy text into a real DATE<br>ALTER TABLE Orders ADD COLUMN OrderDateClean DATE;                    -- create a new empty DATE column to hold the converted values<br><br>UPDATE Orders<br>SET OrderDateClean = STR_TO_DATE(OrderDate, &#39;%Y-%m-%d&#39;)               -- parse ISO-style dates (e.g. 2024-06-09)<br>WHERE OrderDate LIKE &#39;____-__-__&#39;;                                    -- only touch rows shaped like YYYY-MM-DD<br><br>UPDATE Orders<br>SET OrderDateClean = STR_TO_DATE(OrderDate, &#39;%d/%m/%Y&#39;)               -- parse slash-style dates (e.g. 09/06/2024)<br>WHERE OrderDate LIKE &#39;__/__/____&#39;;                                    -- only touch rows shaped like DD/MM/YYYY<br><br>UPDATE Orders<br>SET OrderDateClean = STR_TO_DATE(OrderDate, &#39;%d.%m.%Y&#39;)               -- parse dot-style dates (e.g. 09.06.2024)<br>WHERE OrderDate LIKE &#39;__.__.____&#39;;                                    -- only touch rows shaped like DD.MM.YYYY<br><br>ALTER TABLE Orders DROP COLUMN OrderDate;                             -- remove the old messy text column<br>ALTER TABLE Orders CHANGE COLUMN OrderDateClean OrderDate DATE;       -- rename the clean column back to OrderDate<br><br>-- Step 9: Now that every CustomerID/ProductID is valid, connect the<br>-- tables with keys -- the foundation that makes JOINs reliable<br>-- (DDL: ALTER TABLE ... ADD PRIMARY KEY / FOREIGN KEY)<br>ALTER TABLE Orders ADD PRIMARY KEY (OrderID);                                          -- enforce OrderID uniqueness<br>ALTER TABLE Orders ADD FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID);      -- link every order to a real customer<br>ALTER TABLE Orders ADD FOREIGN KEY (ProductID)  REFERENCES Products(ProductID);        -- link every order to a real product<br><br>SELECT * FROM Orders ORDER BY OrderDate;                              -- sanity check: eyeball the fully cleaned table<br><br><br>-- ---------------------------------------------------------------------<br>-- A NOTE ON TCL AND DCL (from the &quot;SQL Command Categories&quot; slide)<br>-- ---------------------------------------------------------------------<br># TCL (Transaction Control): wraps a set of changes so they either ALL<br># succeed or ALL undo -- useful when cleaning production data. Example<br># (illustrative only -- the cleaning above is already applied):<br>--<br>-- START TRANSACTION;                                    -- mark the start of a group of changes<br>-- UPDATE Products SET Price = 2500 WHERE ProductID = 3;  -- make a change (not saved permanently yet)<br>-- COMMIT;      -- saves the change permanently            -- lock in every change since START TRANSACTION<br>-- -- or --<br>-- ROLLBACK;    -- undoes everything since START TRANSACTION -- cancel every change since START TRANSACTION<br>--<br># DCL (Data Control): manages WHO can access the database -- relevant<br># once multiple analysts share one server. Example syntax only:<br>--<br>-- GRANT SELECT ON DeltaMart.* TO &#39;junior_analyst&#39;@&#39;localhost&#39;;    -- give a user permission to read the database<br>-- REVOKE SELECT ON DeltaMart.* FROM &#39;junior_analyst&#39;@&#39;localhost&#39;; -- take that read permission away<br><br><br>-- (DQL): ANALYSIS -- ANSWERING DELTAMART&#39;S BUSINESS QUESTIONS<br><br># The data is clean. Now we answer the questions DeltaMart management<br># actually cares about -- this is the payoff of everything above.<br><br>--  WHERE -- simple filtering<br>-- &quot;Show me every customer based in Lagos.&quot;<br>SELECT * FROM Customers WHERE City = &#39;Lagos&#39;;                        -- filter rows down to just Lagos customers<br><br>-- &quot;Show me every order paid for by card, with quantity of 3 or more.&quot;<br>SELECT * FROM Orders WHERE PaymentMethod = &#39;Card&#39; AND Quantity &gt;= 3; -- filter with two conditions combined by AND<br><br>--  ORDER BY -- sorting results<br>-- &quot;List products from most expensive to least expensive.&quot;<br>SELECT ProductName, Price FROM Products ORDER BY Price DESC;         -- sort highest price first (DESC = descending)<br><br>-- &quot;List customers alphabetically by first name.&quot;<br>SELECT FirstName, LastName, City FROM Customers ORDER BY FirstName ASC; -- sort A-to-Z (ASC = ascending, the default)<br><br>--  Aggregate functions -- turning rows into a single business number<br>SELECT COUNT(*)              AS TotalCustomers   FROM Customers;     -- count how many customer rows exist<br>SELECT COUNT(*)              AS TotalOrders      FROM Orders;        -- count how many order rows exist<br>SELECT ROUND(AVG(Price), 2)  AS AvgProductPrice  FROM Products;      -- average price, rounded to 2 decimal places<br>SELECT MAX(Price)            AS MostExpensive    FROM Products;      -- find the single highest price<br>SELECT MIN(Price)            AS CheapestProduct  FROM Products;      -- find the single lowest price<br><br>--  GROUP BY + aggregates -- DeltaMart&#39;s real reporting questions<br>-- &quot;How many customers do we have in each city?&quot;<br>SELECT City, COUNT(*) AS NumberOfCustomers<br>FROM Customers<br>GROUP BY City                                                         -- bucket rows by City before counting<br>ORDER BY NumberOfCustomers DESC;                                      -- show the biggest city first<br><br>-- &quot;How many products are in each category, and what&#39;s their average price?&quot;<br>SELECT Category, COUNT(*) AS NumberOfProducts, ROUND(AVG(Price), 2) AS AvgPrice<br>FROM Products<br>GROUP BY Category                                                     -- bucket rows by Category<br>ORDER BY AvgPrice DESC;                                               -- show the priciest category first<br><br>-- &quot;How many orders came through each payment method?&quot;<br>SELECT PaymentMethod, COUNT(*) AS NumberOfOrders<br>FROM Orders<br>GROUP BY PaymentMethod                                                -- bucket rows by PaymentMethod<br>ORDER BY NumberOfOrders DESC;                                         -- show the most-used method first<br><br>--   JOIN -- connecting Customers + Orders + Products into one report<br># A JOIN combines related information so you can build a complete<br># picture -- exactly what the slide deck&#39;s &quot;Connecting Multiple Tables&quot;<br># section covers.<br><br>-- Full order report: who bought what, and how much they paid.<br>SELECT<br>    o.OrderID,<br>    c.FirstName,<br>    c.LastName,<br>    c.City,<br>    p.ProductName,<br>    p.Category,<br>    o.Quantity,<br>    p.Price,<br>    (o.Quantity * p.Price) AS OrderTotal,   -- calculate revenue per order on the fly<br>    o.OrderDate,<br>    o.PaymentMethod<br>FROM Orders o<br>INNER JOIN Customers c ON o.CustomerID = c.CustomerID   -- pull in the matching customer&#39;s details<br>INNER JOIN Products  p ON o.ProductID  = p.ProductID    -- pull in the matching product&#39;s details<br>ORDER BY o.OrderDate;                                   -- show orders in date order<br><br>-- JOIN + GROUP BY -- the question every retailer wants answered:<br>-- &quot;Which city generates the most revenue?&quot;<br>SELECT<br>    c.City,<br>    SUM(o.Quantity * p.Price) AS TotalRevenue                         -- add up revenue across every order per city<br>FROM Orders o<br>INNER JOIN Customers c ON o.CustomerID = c.CustomerID                 -- join to know which city each order belongs to<br>INNER JOIN Products  p ON o.ProductID  = p.ProductID                  -- join to know each order&#39;s price<br>GROUP BY c.City                                                       -- bucket the totals by city<br>ORDER BY TotalRevenue DESC;                                           -- show the top-earning city first<br><br>-- &quot;Which product category sells the most units?&quot;<br>SELECT<br>    p.Category,<br>    SUM(o.Quantity) AS UnitsSold,                                     -- total items sold per category<br>    SUM(o.Quantity * p.Price) AS TotalRevenue                         -- total revenue per category<br>FROM Orders o<br>INNER JOIN Products p ON o.ProductID = p.ProductID                    -- join to know each order&#39;s category and price<br>GROUP BY p.Category                                                   -- bucket by category<br>ORDER BY TotalRevenue DESC;                                           -- show the highest-earning category first<br><br>-- &quot;Who are our top 5 customers by total amount spent?&quot;<br>SELECT<br>    c.FirstName,<br>    c.LastName,<br>    SUM(o.Quantity * p.Price) AS TotalSpent                           -- add up everything each customer has spent<br>FROM Orders o<br>INNER JOIN Customers c ON o.CustomerID = c.CustomerID                 -- join to know which customer placed each order<br>INNER JOIN Products  p ON o.ProductID  = p.ProductID                  -- join to know each order&#39;s price<br>GROUP BY c.CustomerID, c.FirstName, c.LastName                        -- bucket by individual customer<br>ORDER BY TotalSpent DESC                                              -- show the biggest spenders first<br>LIMIT 5;                                                              -- only keep the top 5 rows<br><br>-- =====================================================================<br>-- END OF SCRIPT<br>-- Next step: connect Power BI (or Excel/Tableau) to this DeltaMart<br>-- database and turn these queries into a dashboard -- see the<br>-- accompanying Business Brief for exactly what to build.</pre><h4><strong>Conclusion</strong></h4><p>I came into this project expecting the hard part to be the dashboard. It was not. The hard part was the several hours before I ever opened Power BI, sitting inside three messy tables, deciding row by row what was fixable, what was guessable, and what I honestly had to delete rather than fake. That is the part of the job this project actually taught me.</p><p>I am closing this report the same way I opened it, honestly. My dashboard and my own exported analytic file disagree on total revenue and total customers, my city cleaning missed one city; my price fix for two products did not make it into my final export; and my earlier findings document made a profitability claim my data cannot support and used a customer identifier, first name, that I now know is not reliable. None of that erases the work. Port Harcourt really is DeltaMart’s strongest city, Fashion really does move the most units; furniture really does earn the most revenue per order; and transfer really is the most used payment method, even after every correction above. What changed by the end of this report is not the underlying data; it is how carefully I am willing to state what it actually shows.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc14ba936450" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>