The dataset I used was obtained from Kaggle and contained raw data regarding café transactions. The original data was messy and required significant cleaning to be useful for analysis. I started by using SQL to:
After cleaning the data, I moved to Tableau to create several key visualizations. Some of the main insights included:
The outcome of this project was a series of interactive dashboards and graphs that allowed the café to make data-driven decisions about product offerings, marketing strategies, and operational adjustments.
CREATE TABLE cafe LIKE `tableconvert.com_q1n0gf`;
INSERT cafe
SELECT *
FROM `tableconvert.com_q1n0gf`;
ALTER TABLE cafe
DROP COLUMN ID;
UPDATE cafe
SET payment_method = NULL
WHERE payment_method LIKE '%ERROR%' OR payment_method LIKE '%UNKNOWN%';
UPDATE cafe
SET total_spent = NULL
WHERE total_spent LIKE '%ERROR%' OR total_spent LIKE '%UNKNOWN%';
UPDATE cafe
SET total_spent = NULL
WHERE total_spent LIKE '%ERROR%' OR total_spent LIKE '%UNKNOWN%';
UPDATE cafe
SET Location = NULL
WHERE Location LIKE '%ERROR%' OR Location LIKE '%UNKNOWN%';
UPDATE cafe
SET Item = NULL
WHERE Item LIKE '%ERROR%' OR Item LIKE '%UNKNOWN%';
UPDATE cafe
SET transaction_date = NULL
WHERE transaction_date LIKE '%ERROR%' OR transaction_date LIKE '%UNKNOWN%';
UPDATE cafe
SET payment_method = 'Credit Card'
WHERE payment_method LIKE 'Digital%';
UPDATE cafe
SET total_spent = price_unit * Quantity
WHERE price_unit IS NOT NULL AND Quantity IS NOT NULL;
DELETE FROM cafe
WHERE Item IS NULL OR Item = "";
ALTER TABLE cafe
MODIFY COLUMN transaction_date DATE;
ALTER TABLE cafe
MODIFY COLUMN transaction_date DATE;
SELECT *
FROM cafe;
CREATE DATABASE Cafe;
USE Cafe;
SET SQL_SAFE_UPDATES = 0;
CREATE TABLE cafe
LIKE dirty_cafe_sales;
SELECT *
FROM cafe;
INSERT INTO cafe
SELECT *
FROM dirty_cafe_sales;
SELECT `Transaction ID`, COUNT(*)
FROM cafe
GROUP BY `Transaction ID`
HAVING COUNT(*) >1;
-- No repetead transactions
SELECT `Transaction ID`, `Total Spent`
FROM cafe
WHERE `Total Spent` = ''
OR `Total Spent` = 'ERROR'
OR `Total Spent` = 'UNKNOWN';
UPDATE cafe
SET `Total Spent` = NULL
WHERE `Total Spent` = ''
OR `Total Spent` = 'ERROR'
OR `Total Spent` = 'UNKNOWN';
SELECT `Total Spent`
FROM cafe
WHERE `Total Spent` IS NULL;
SELECT Quantity, `Price Per Unit`,`Total Spent`
FROM cafe;
UPDATE cafe
SET `Total Spent` = Quantity * `Price Per Unit`
WHERE `Price Per Unit` IS NOT NULL OR Quantity IS NOT NULL;
SELECT `Payment Method`
FROM cafe;
UPDATE cafe
SET `Payment Method` = 'Credit Card'
WHERE `Payment Method` = 'Digital Wallet';
Select *
FROM cafe;
UPDATE cafe
SET `Transaction Date` = NULL
WHERE `Transaction Date` = ''
OR `Transaction Date` = 'ERROR'
OR `Transaction Date` = 'UNKNOWN';
ALTER TABLE cafe
MODIFY COLUMN `Transaction Date` DATE;
UPDATE cafe
SET Item = NUll
WHERE Item = ''
OR Item = 'ERROR'
OR Item = 'UNKNOWN';
DELETE FROM cafe
WHERE Item IS NULL;
Select *
FROM cafe;
UPDATE cafe
SET `Payment Method` = NULL
WHERE `Payment Method` = ''
OR `Payment Method` = 'ERROR'
OR `Payment Method` = 'UNKNOWN';
UPDATE cafe
SET `Location` = NULL
WHERE `Location` = ''
OR `Location` = 'ERROR'
OR `Location` = 'UNKNOWN';