File size: 4,299 Bytes
fae86c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
aaaffa8
 
fae86c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
## The Tables in the Default Database are: 
    `customers`, `order_items`, `orders`, `payments`, and `products`.

### **customers**
|       | customer_id   |   customer_zip_code_prefix | customer_city   | customer_state   |
|------:|:--------------|---------------------------:|:----------------|:-----------------|
| 21921 | 0tgYlOTGgpO6  |                      79230 | russas          | CE               |
|  9748 | jGhRQF3CIew4  |                      81460 | joao monlevade  | MG               |
| 22679 | 1UutQTIhBvcP  |                      94480 | pelotas         | RS               |

Rows: 38279, Columns: 4

```sql
CREATE TABLE customers (
    customer_id VARCHAR(255) PRIMARY KEY,
    customer_zip_code_prefix INT,
    customer_city VARCHAR(255),
    customer_state VARCHAR(2)
);
```

### **order_items**
|       | order_id     | product_id   | seller_id    |   price |   shipping_charges |
|------:|:-------------|:-------------|:-------------|--------:|-------------------:|
| 19729 | PDEzZdebLSn3 | aBpYjaBcwz6e | bzfcwRPnZzVO |   55.83 |              27.8  |
|  6001 | R7bIPjjYqlHP | ZM2JJXV5m9hl | Ivbw25fb5t2Z |  100    |              42.05 |
|   282 | Biqo21nETaMO | XqmdGKRbTetH | P2nCHWuo0HC0 |  113.49 |              91.32 |

Rows: 38279, Columns: 5

```sql
CREATE TABLE order_items (
    order_id VARCHAR(255),
    product_id VARCHAR(255),
    seller_id VARCHAR(255),
    price DECIMAL(10, 2),
    shipping_charges DECIMAL(10, 2),
    PRIMARY KEY (order_id, product_id),
    FOREIGN KEY (order_id) REFERENCES orders(order_id),
    FOREIGN KEY (product_id) REFERENCES products(product_id)
);
```

### **orders**

|       | order_id     | customer_id   | order_purchase_timestamp   | order_approved_at   |
|------:|:-------------|:--------------|:---------------------------|:--------------------|
|  7294 | PMqwQc01iDTJ | c9ueC6k6V5WS  | 2018-06-19 21:23:48        | 2018-06-20 08:38:30 |
| 13800 | P4l8R2Qat5n7 | ovKkGaXi5TmN  | 2018-01-05 08:26:03        | 2018-01-05 08:47:20 |
| 17679 | NxIseZjAQCdC | o9qzmUQVJOxA  | 2018-01-28 23:46:53        | 2018-01-28 23:58:31 |

Rows: 38279, Columns: 4

```sql
CREATE TABLE orders (
    order_id VARCHAR(255) PRIMARY KEY,
    customer_id VARCHAR(255),
    order_purchase_timestamp VARCHAR(255),
    order_approved_at VARCHAR(255),
    FOREIGN KEY (customer_id) REFERENCES customers(customer_id)
);
```

### **payments**
|       | order_id     |   payment_sequential | payment_type   |   payment_installments |   payment_value |
|------:|:-------------|---------------------:|:---------------|-----------------------:|----------------:|
| 35526 | cQXl0pQtiMad |                    1 | wallet         |                      1 |          172.58 |
| 35799 | olImD2k316Gz |                    1 | credit_card    |                      3 |           16.78 |
| 13278 | G9MJYXXtPZSz |                    1 | credit_card    |                     10 |          221.86 |

Rows: 38279, Columns: 5

```sql
CREATE TABLE payments (
    order_id VARCHAR(255),
    payment_sequential INT,
    payment_type VARCHAR(50),
    payment_installments INT,
    payment_value DECIMAL(10, 2),
    PRIMARY KEY (order_id, payment_sequential),
    FOREIGN KEY (order_id) REFERENCES orders(order_id)
);
```

### **products**
|       | product_id   | product_category_name   |   product_weight_g |   product_length_cm |   product_height_cm |   product_width_cm |
|------:|:-------------|:------------------------|-------------------:|--------------------:|--------------------:|-------------------:|
| 18191 | hpiXwRzTkhkL | bed_bath_table          |               1150 |                  40 |                   9 |                 50 |
|  2202 | iPoRkE7dkmlc | toys                    |              15800 |                  38 |                  62 |                 57 |
| 27442 | hrjNaMt3Wyo5 | toys                    |               1850 |                  37 |                  22 |                 40 |

Rows: 38279, Columns: 6

```sql
CREATE TABLE products (
    product_id VARCHAR(255) PRIMARY KEY,
    product_category_name VARCHAR(255),
    product_weight_g INT,
    product_length_cm INT,
    product_height_cm INT,
    product_width_cm INT
);
```