-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchallenge_schema_and_queries.sql
56 lines (39 loc) · 1.25 KB
/
challenge_schema_and_queries.sql
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
------------------- CREATING TABLE ---------------------
CREATE TABLE review_id_table (
review_id TEXT PRIMARY KEY NOT NULL,
customer_id INTEGER,
product_id TEXT,
product_parent INTEGER,
review_date DATE -- this should be in the formate yyyy-mm-dd
);
-- This table will contain only unique values
CREATE TABLE products_table (
product_id TEXT PRIMARY KEY NOT NULL UNIQUE,
product_title TEXT
);
-- Customer table for first data set
CREATE TABLE customers_table (
customer_id INT PRIMARY KEY NOT NULL UNIQUE,
customer_count INT
);
-- vine table
CREATE TABLE vine_table (
review_id TEXT PRIMARY KEY,
star_rating INTEGER,
helpful_votes INTEGER,
total_votes INTEGER,
vine TEXT,
verified_purchase TEXT
);
------------- DISPLAY review_id_table. ----------------
SELECT * FROM review_id_table;
SELECT count(*) FROM review_id_table;
------------- DISPLAY customers_table --------------------
SELECT * FROM customers_table;
SELECT count(*) FROM customers_table;
------------- DISPLAY vine_table --------------------
SELECT * FROM vine_table;
SELECT count(*) FROM vine_table;
------------- DISPLAY products_table --------------------
SELECT * FROM products_table;
SELECT count(*) FROM products_table;