-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSuperstore Database
71 lines (59 loc) · 2.4 KB
/
Superstore Database
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#Schema
#This code is utilizing the following superstore data:
CREATE TABLE superstore (
item_id INTEGER PRIMARY KEY,
item_name TEXT,
category TEXT,
price DECIMAL(10, 2),
stock_quantity INTEGER,
average_rating DECIMAL(3, 2)
);
INSERT INTO superstore (item_id, item_name, category, price, stock_quantity, average_rating)
VALUES
(1, 'Stainless Steel Cookware Set', 'Kitchen Supplies', 89.99, 50, 4.6),
(2, 'Memory Foam Mattress', 'Furnishings', 499.99, 30, 4.8),
(3, 'Smart LED TV', 'Electronics', 549.00, 20, 4.5),
(4, 'Robot Vacuum Cleaner', 'Appliances', 199.50, 40, 4.3),
(5, 'Wireless Bluetooth Speaker', 'Electronics', 39.99, 60, 4.2),
(6, 'Non-Stick Baking Set', 'Kitchen Supplies', 29.95, 80, 4.4),
(7, 'Cotton Bedding Set', 'Furnishings', 89.00, 25, 4.7),
(8, 'Smart Home Security Camera', 'Electronics', 79.95, 15, 4.1),
(9, 'Air Purifier', 'Appliances', 129.50, 35, 4.6),
(10, 'Premium Coffee Maker', 'Kitchen Supplies', 79.99, 50, 4.9),
(11, 'Ergonomic Office Chair', 'Furnishings', 189.00, 20, 4.5),
(12, 'Wireless Earbuds', 'Electronics', 49.99, 75, 4.3),
(13, 'Slow Cooker', 'Appliances', 49.95, 30, 4.7),
(14, 'Cutlery Set', 'Kitchen Supplies', 34.50, 40, 4.4),
(15, 'Cozy Throw Blanket', 'Furnishings', 24.99, 100, 4.2);
#Queries
#I used SQL to query the data provided, allowing me to organize the information in a helpful way
/*How many unique items are being sold*/
SELECT COUNT(*) AS unique_items
FROM superstore;
/*The amount of different items in each category*/
SELECT category, COUNT(*) AS unique_items
FROM superstore
GROUP BY category;
/*Ordering the items by price from most expensive to least expensive*/
SELECT item_name, price
FROM superstore
ORDER BY price desc;
/*Finding the cheapest price of an item at the superstore(other than buying nothing)*/
SELECT MIN(price) AS cheapest_price
FROM superstore;
/*Items with ratings 4.5 and above*/
SELECT item_name, average_rating
FROM superstore
WHERE average_rating >= 4.5
ORDER BY average_rating desc;
/*The average rating of all the different items sold at the superstore*/
SELECT AVG(average_rating) AS averageRating
FROM superstore;
/*How many Smart LED TVs are in stock*/
SELECT item_name, stock_quantity
FROM superstore
WHERE item_name = "Smart LED TV";
/*Important information for "SMART" items*/
SELECT item_name, price, stock_quantity
FROM superstore
WHERE item_name LIKE "%Smart%";