-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCleaning_sql.sql
More file actions
50 lines (50 loc) · 1.04 KB
/
Cleaning_sql.sql
File metadata and controls
50 lines (50 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
-- Data Exploration
-- Count Of Rows
SELECT COUNT(*) FROM Zepto;
-- Sample Data
SELECT * FROM Zepto
LIMIT 10;
-- Null values
SELECT * FROM Zepto
WHERE name is null
OR
category is null
or
mrp is null
OR
discountpercent is null
OR
availablequantity is null
OR
discountedsellingprice is null
OR
Weightingms is null
OR
Outofstock is null
OR
Quantity is null;
-- Different Product Category
SELECT DISTINCT category
FROM Zepto
ORDER BY Category;
-- Product In stock vs Out of stock
SELECT Outofstock, COUNT (sku_id)
FROM Zepto
GROUP BY Outofstock;
-- product name present multiple times
SELECT name, COUNT(sku_id) as "Number of SKUs"
FROM zepto
GROUP BY name
HAVING count(sku_id) > 1
ORDER BY count(sku_id) DESC;
-- Data Cleaning
-- Products with price = 0
SELECT * FROM Zepto
WHERE mrp =0 OR discountedsellingprice = 0;
DELETE FROM Zepto
WHERE mrp = 0;
-- Convert Paise into Rupees
UPDATE Zepto
SET mrp = mrp/100.0,
discountedsellingprice = discountedsellingprice/100.0;
SELECT mrp,discountedsellingprice FROM zepto;