Skip to content

Commit 91bf144

Browse files
schema addition and correction
1 parent f9364bf commit 91bf144

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

Game Play Analysis/schema.sql

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,17 @@
1-
Create table If Not Exists Activity (player_id int, device_id int, event_date date, games_played int)
2-
Truncate table Activity
3-
insert into Activity (player_id, device_id, event_date, games_played) values ('1', '2', '2016-03-01', '5')
4-
insert into Activity (player_id, device_id, event_date, games_played) values ('1', '2', '2016-03-02', '6')
5-
insert into Activity (player_id, device_id, event_date, games_played) values ('2', '3', '2017-06-25', '1')
6-
insert into Activity (player_id, device_id, event_date, games_played) values ('3', '1', '2016-03-02', '0')
7-
insert into Activity (player_id, device_id, event_date, games_played) values ('3', '4', '2018-07-03', '5')
1+
CREATE TABLE IF NOT EXISTS Activity (
2+
player_id int,
3+
device_id int,
4+
event_date date,
5+
games_played int
6+
);
7+
8+
TRUNCATE TABLE Activity;
9+
10+
INSERT INTO
11+
Activity (player_id, device_id, event_date, games_played)
12+
VALUES
13+
(1, 2, '2016-03-01', 5),
14+
(1, 2, '2016-03-02', 6),
15+
(2, 3, '2017-06-25', 1),
16+
(3, 1, '2016-03-02', 0),
17+
(3, 4, '2018-07-03', 5);

Highest-Grossing Items/schema.sql

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CREATE TABLE IF NOT EXISTS product_spend (
2+
category VARCHAR(50),
3+
product VARCHAR(100),
4+
user_id INT,
5+
spend DECIMAL(10, 2),
6+
transaction_date TIMESTAMP
7+
);
8+
9+
INSERT INTO product_spend (category, product, user_id, spend, transaction_date)
10+
VALUES
11+
('appliance', 'refrigerator', 165, 246.00, '2021-12-26 12:00:00'),
12+
('appliance', 'refrigerator', 123, 299.99, '2022-03-02 12:00:00'),
13+
('appliance', 'washing machine', 123, 219.80, '2022-03-02 12:00:00'),
14+
('electronics', 'vacuum', 178, 152.00, '2022-04-05 12:00:00'),
15+
('electronics', 'wireless headset', 156, 249.90, '2022-07-08 12:00:00'),
16+
('electronics', 'vacuum', 145, 189.00, '2022-07-15 12:00:00');

0 commit comments

Comments
 (0)