|
| 1 | +Transactions |
| 2 | +- |
| 3 | +transaction_id PK int |
| 4 | +order_id int INDEX |
| 5 | +order_line_number int |
| 6 | +order_date date |
| 7 | +order_year int |
| 8 | +order_month int |
| 9 | +order_month_name string |
| 10 | +order_quarter string |
| 11 | +order_day_of_week string |
| 12 | +ship_date date |
| 13 | +delivery_date date |
| 14 | + |
| 15 | +customer_id FK int |
| 16 | +customer_full_name string |
| 17 | +customer_first_name string |
| 18 | +customer_last_name string |
| 19 | +customer_email string |
| 20 | +customer_phone string |
| 21 | +customer_city string |
| 22 | +customer_state string |
| 23 | +customer_zip string |
| 24 | +customer_region string |
| 25 | +customer_segment string |
| 26 | +customer_gender string |
| 27 | +customer_age int |
| 28 | +customer_age_group string |
| 29 | + |
| 30 | +product_id int |
| 31 | +product_name string |
| 32 | +sku string UNIQUE |
| 33 | +brand string |
| 34 | +category string |
| 35 | +sub_category string |
| 36 | +department string |
| 37 | + |
| 38 | +quantity_ordered int |
| 39 | +unit_list_price decimal |
| 40 | +discount_pct decimal |
| 41 | +unit_selling_price decimal |
| 42 | +line_total_before_tax decimal |
| 43 | +tax_rate_pct decimal |
| 44 | +tax_amount decimal |
| 45 | +line_total_with_tax decimal |
| 46 | + |
| 47 | +store_id int |
| 48 | +store_name string |
| 49 | +store_city string |
| 50 | +store_state string |
| 51 | +store_region string |
| 52 | +store_type string |
| 53 | + |
| 54 | +employee_id int |
| 55 | +employee_name string |
| 56 | +employee_job_title string |
| 57 | + |
| 58 | +promo_id int |
| 59 | +promo_name string |
| 60 | + |
| 61 | +sales_channel string |
| 62 | +payment_method string |
| 63 | +shipping_method string |
| 64 | +order_status string |
| 65 | +is_returned boolean |
| 66 | + |
| 67 | +cost_price decimal |
| 68 | +gross_profit decimal |
| 69 | + |
| 70 | +data_source string |
| 71 | +record_created_ts timestamp |
| 72 | +last_modified_ts timestamp |
| 73 | + |
| 74 | + |
| 75 | + |
| 76 | +# CUSTOMER TABLE DIGRAM |
| 77 | +Customer as c |
| 78 | +- |
| 79 | +customer_id PK int |
| 80 | +title string |
| 81 | +first_name string |
| 82 | +last_name string |
| 83 | +full_name string INDEX |
| 84 | +gender string |
| 85 | +date_of_birth date |
| 86 | +age int |
| 87 | +email string UNIQUE |
| 88 | +phone string |
| 89 | +address string |
| 90 | +city string |
| 91 | +state string |
| 92 | +state_abbr string |
| 93 | +state_full string |
| 94 | +zip_code string |
| 95 | +country string |
| 96 | +region string |
| 97 | +customer_segment string |
| 98 | +loyalty_points int |
| 99 | +is_active boolean |
| 100 | +account_created_date date |
| 101 | +preferred_channel string |
| 102 | +annual_income_usd decimal |
| 103 | +company string |
| 104 | + |
| 105 | +Transactions |
| 106 | +- |
| 107 | +transaction_id PK int |
| 108 | +order_id int INDEX |
| 109 | +order_line_number int |
| 110 | +order_date date |
| 111 | +order_year int |
| 112 | +order_month int |
| 113 | +order_month_name string |
| 114 | +order_quarter string |
| 115 | +order_day_of_week string |
| 116 | +ship_date date |
| 117 | +delivery_date date |
| 118 | +customer_id int FK >- Customer.customer_id |
| 119 | +customer_full_name string |
| 120 | +customer_first_name string |
| 121 | +customer_last_name string |
| 122 | +customer_email string |
| 123 | +customer_phone string |
| 124 | +customer_city string |
| 125 | +customer_state string |
| 126 | +customer_zip string |
| 127 | +customer_region string |
| 128 | +customer_segment string |
| 129 | +customer_gender string |
| 130 | +customer_age int |
| 131 | +customer_age_group string |
| 132 | +product_id int |
| 133 | +product_name string |
| 134 | +sku string UNIQUE |
| 135 | +brand string |
| 136 | +category string |
| 137 | +sub_category string |
| 138 | +department string |
| 139 | +quantity_ordered int |
| 140 | +unit_list_price decimal |
| 141 | +discount_pct decimal |
| 142 | +unit_selling_price decimal |
| 143 | +line_total_before_tax decimal |
| 144 | +tax_rate_pct decimal |
| 145 | +tax_amount decimal |
| 146 | +line_total_with_tax decimal |
| 147 | +store_id int |
| 148 | +store_name string |
| 149 | +store_city string |
| 150 | +store_state string |
| 151 | +store_region string |
| 152 | +store_type string |
| 153 | +employee_id int |
| 154 | +employee_name string |
| 155 | +employee_job_title string |
| 156 | +promo_id int |
| 157 | +promo_name string |
| 158 | +sales_channel string |
| 159 | +payment_method string |
| 160 | +shipping_method string |
| 161 | +order_status string |
| 162 | +is_returned boolean |
| 163 | +cost_price decimal |
| 164 | +gross_profit decimal |
| 165 | +data_source string |
| 166 | +record_created_ts timestamp |
| 167 | +last_modified_ts timestamp |
| 168 | + |
| 169 | + |
| 170 | +# Modify this code to update the DB schema diagram. |
| 171 | +# To reset the sample schema, replace everything with |
| 172 | +# two dots ('..' - without quotes). |
| 173 | + |
| 174 | +Customer |
| 175 | +- |
| 176 | +CustomerID PK int |
| 177 | +Name string INDEX |
| 178 | +Address1 string |
| 179 | +Address2 NULL string |
| 180 | +Address3 NULL string |
| 181 | + |
| 182 | +Order |
| 183 | +- |
| 184 | +OrderID PK int |
| 185 | +CustomerID int FK >- Customer.CustomerID |
| 186 | +TotalAmount money |
| 187 | +OrderStatusID int FK >- os.OrderStatusID |
| 188 | + |
| 189 | +OrderLine as ol |
| 190 | +---- |
| 191 | +OrderLineID PK int |
| 192 | +OrderID int FK >- Order.OrderID |
| 193 | +ProductID int FK >- p.ProductID |
| 194 | +Quantity int |
| 195 | + |
| 196 | +# Table documentation comment 1 (try the PDF/RTF export) |
| 197 | +Product as p # Table documentation comment 2 |
| 198 | +------------ |
| 199 | +ProductID PK int |
| 200 | +# Field documentation comment 1 |
| 201 | +# Field documentation comment 2 |
| 202 | +Name varchar(200) UNIQUE # Field documentation comment 3 |
| 203 | +Price money |
| 204 | + |
| 205 | +OrderStatus as os |
| 206 | +---- |
| 207 | +OrderStatusID PK int |
| 208 | +Name UNIQUE string |
0 commit comments