-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathschema_description.json
More file actions
381 lines (381 loc) · 52.1 KB
/
Copy pathschema_description.json
File metadata and controls
381 lines (381 loc) · 52.1 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
{
"customerInfo": {
"person_customer_id SERIAL PRIMARY KEY": "This set of columns describes a database table for storing customer information. Here's a breakdown:",
"person_first_name VARCHAR(50) NOT NULL": "",
"person_last_name VARCHAR(50) NOT NULL": "**Basic Information:**",
"person_email VARCHAR(255) UNIQUE NOT NULL": "",
"person_phone_number VARCHAR(20)": "* `person_customer_id SERIAL PRIMARY KEY`: Unique, automatically incrementing identifier for each customer.",
"person_date_of_birth DATE": "* `person_first_name VARCHAR(50) NOT NULL`: Customer's first name (required).",
"person_gender CHAR(1)": "* `person_last_name VARCHAR(50) NOT NULL`: Customer's last name (required).",
"person_registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* `person_email VARCHAR(255) UNIQUE NOT NULL`: Customer's email address (required, must be unique).",
"person_last_login TIMESTAMP": "* `person_phone_number VARCHAR(20)`: Customer's phone number.",
"person_is_premium BOOLEAN DEFAULT FALSE": "* `person_date_of_birth DATE`: Customer's date of birth.",
"person_loyalty_points INT DEFAULT 0": "* `person_gender CHAR(1)`: Customer's gender (likely M/F/etc.).",
"person_preferred_language VARCHAR(20)": "* `person_registration_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP`: Date and time the customer registered. Defaults to the current timestamp.",
"person_occupation VARCHAR(100)": "* `person_last_login TIMESTAMP`: Date and time of the customer's last login.",
"person_income NUMERIC(10,2)": "* `person_is_premium BOOLEAN DEFAULT FALSE`: Indicates whether the customer has a premium account.",
"person_marital_status VARCHAR(20)": "* `person_loyalty_points INT DEFAULT 0`: Number of loyalty points the customer has.",
"address_street VARCHAR(255)": "* `person_preferred_language VARCHAR(20)`: Customer's preferred language.",
"address_city VARCHAR(100)": "* `person_occupation VARCHAR(100)`: Customer's occupation.",
"address_state VARCHAR(100)": "* `person_income NUMERIC(10,2)`: Customer's income.",
"address_country VARCHAR(100)": "* `person_marital_status VARCHAR(20)`: Customer's marital status.",
"address_postalcode VARCHAR(20)": "",
"account_account_balance NUMERIC(12,2) DEFAULT 0.00": "**Address:**",
"account_preferred_payment_method VARCHAR(50)": "",
"account_card_last_four VARCHAR(4)": "* `address_street VARCHAR(255)`: Customer's street address.",
"account_card_expiry DATE": "* `address_city VARCHAR(100)`: Customer's city.",
"account_has_active_subscription BOOLEAN DEFAULT FALSE": "* `address_state VARCHAR(100)`: Customer's state/province.",
"preferences_favorite_category VARCHAR(100)": "* `address_country VARCHAR(100)`: Customer's country.",
"preferences_avg_spent_per_order NUMERIC(10,2)": "* `address_postalcode VARCHAR(20)`: Customer's postal code.",
"preferences_total_orders INT DEFAULT 0": "",
"preferences_last_order_date TIMESTAMP": "**Account & Payment:**",
"preferences_wishlist_items INT DEFAULT 0": "",
"preferences_newsletter_subscription BOOLEAN DEFAULT TRUE": "* `account_account_balance NUMERIC(12,2) DEFAULT 0.00`: Customer's account balance.",
"preferences_referral_code VARCHAR(20)": "* `account_preferred_payment_method VARCHAR(50)`: Customer's preferred payment method.",
"securitypassword_hash TEXT NOT NULL": "* `account_card_last_four VARCHAR(4)`: Last four digits of the customer's payment card.",
"security_question VARCHAR(255)": "* `account_card_expiry DATE`: Expiry date of the customer's payment card.",
"security_answer_hash TEXT": "* `account_has_active_subscription BOOLEAN DEFAULT FALSE`: Indicates whether the customer has an active subscription.",
"securitytwo_factor_enabled BOOLEAN DEFAULT FALSE": "",
"securitysms_notifications BOOLEAN DEFAULT TRUE": "**Shopping Preferences:**",
"securityemail_notifications BOOLEAN DEFAULT TRUE": "",
"security_account_status VARCHAR(20)": "* `preferences_favorite_category VARCHAR(100)`: Customer's favorite product category."
},
"campaigns": {
"campaign_id SERIAL PRIMARY KEY": "This set of SQL columns describes a table for storing information about marketing campaigns.",
"campaign_name VARCHAR(255) NOT NULL": "",
"campaign_type VARCHAR(50) NOT NULL": "- `campaign_id`: A unique, automatically incrementing integer that serves as the primary key for identifying each campaign.",
"campaign_status VARCHAR(20)": "- `campaign_name`: The name of the campaign (required).",
"start_date TIMESTAMP NOT NULL": "- `campaign_type`: The type of campaign (e.g., 'email', 'social media', 'PPC') (required).",
"end_date TIMESTAMP NOT NULL": "- `campaign_status`: The current status of the campaign (e.g., 'active', 'paused', 'completed').",
"budget NUMERIC(12,2)": "- `start_date`: The date and time the campaign started (required).",
"actual_spent NUMERIC(12,2) DEFAULT 0.00": "- `end_date`: The date and time the campaign ended (required).",
"target_audience VARCHAR(255), -- e.g., 'New Users', 'Returning Customers', 'High Spenders'\n total_reach INT DEFAULT 0, -- Number of people targeted\n impressions INT DEFAULT 0, -- Number of times campaign was viewed\n clicks INT DEFAULT 0, -- Clicks on campaign link\n conversions INT DEFAULT 0, -- Number of successful purchases\n revenue_generated NUMERIC(12,2) DEFAULT 0.00": "- `budget`: The planned budget for the campaign.",
"discount_code VARCHAR(50), -- Discount code used in campaign if applicable\n discount_value NUMERIC(10,2), -- Discount value associated with the campaign\n email_open_rate DECIMAL(5,2) , -- Open rate percentage\n email_click_through_rate DECIMAL(5,2) , -- CTR percentage\n cost_per_acquisition NUMERIC(10,2) DEFAULT 0.00, -- CPA metric\n roi DECIMAL(10,2) GENERATED ALWAYS AS ((revenue_generated - actual_spent) / NULLIF(actual_spent, 0) * 100) STORED -- ROI percentage": "- `actual_spent`: The amount actually spent on the campaign, defaulting to 0."
},
"suppliers": {
"supplier_unique_identifier SERIAL PRIMARY KEY": "* `supplier_unique_identifier SERIAL PRIMARY KEY`: A unique, automatically incrementing integer that serves as the primary key for identifying each supplier.",
"official_supplier_business_name VARCHAR(255) NOT NULL": "",
"registered_business_address VARCHAR(255)": "* `official_supplier_business_name VARCHAR(255) NOT NULL`: The official name of the supplier's business, which is required.",
"primary_contact_person_name VARCHAR(255)": "",
"primary_contact_phone_number VARCHAR(20)": "* `registered_business_address VARCHAR(255)`: The registered address of the supplier's business.",
"primary_contact_email_address VARCHAR(255) UNIQUE": "",
"supplier_country_of_operation VARCHAR(100)": "* `primary_contact_person_name VARCHAR(255)`: The name of the primary contact person for the supplier.",
"supplier_tax_identification_number VARCHAR(50)": "",
"preferred_payment_terms_description TEXT": "* `primary_contact_phone_number VARCHAR(20)`: The phone number of the primary contact person.",
"total_number_of_products_supplied INT DEFAULT 0": "",
"average_supplier_rating DECIMAL(3,2) DEFAULT 0.0": "* `primary_contact_email_address VARCHAR(255) UNIQUE`: The email address of the primary contact person, which must be unique for each supplier."
},
"orders": {
"order_id SERIAL PRIMARY KEY": "These SQL columns describe an `orders` table likely related to e-commerce or order management.",
"person_customer_id INT NOT NULL": "",
"order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "- `order_id SERIAL PRIMARY KEY`: Unique, auto-incrementing identifier for each order.",
"shipping_date TIMESTAMP": "- `person_customer_id INT NOT NULL`: Foreign key referencing the `customerInfo` table, indicating which customer placed the order. Required. Cascades deletes from `customerInfo`.",
"delivery_date TIMESTAMP": "- `order_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP`: Date and time the order was placed. Defaults to the current timestamp.",
"order_status VARCHAR(50)": "- `shipping_date TIMESTAMP`: Date and time the order was shipped.",
"total_amount NUMERIC(10,2) NOT NULL": "- `delivery_date TIMESTAMP`: Date and time the order was delivered.",
"discount_applied NUMERIC(10,2) DEFAULT 0.00": "- `order_status VARCHAR(50)`: Status of the order (e.g., \"Pending,\" \"Shipped,\" \"Delivered,\" \"Cancelled\").",
"tax_amount NUMERIC(10,2) DEFAULT 0.00": "- `total_amount NUMERIC(10,2) NOT NULL`: Total amount of the order (up to 99999999.99). Required.",
"shipping_fee NUMERIC(10,2) DEFAULT 0.00": "- `discount_applied NUMERIC(10,2) DEFAULT 0.00`: Amount of discount applied to the order. Defaults to 0.",
"payment_status VARCHAR(50)": "- `tax_amount NUMERIC(10,2) DEFAULT 0.00`: Amount of tax applied to the order. Defaults to 0.",
"payment_method VARCHAR(50)": "- `shipping_fee NUMERIC(10,2) DEFAULT 0.00`: Shipping fee for the order. Defaults to 0.",
"tracking_number VARCHAR(50) UNIQUE": "- `payment_status VARCHAR(50)`: Status of the payment (e.g., \"Paid,\" \"Pending,\" \"Failed\").",
"shipping_address_street VARCHAR(255)": "- `payment_method VARCHAR(50)`: Method of payment used (e.g., \"Credit Card,\" \"PayPal\").",
"shipping_address_city VARCHAR(100)": "- `tracking_number VARCHAR(50) UNIQUE`: Unique tracking number for the shipment.",
"shipping_address_state VARCHAR(100)": "- `shipping_address_street VARCHAR(255)`: Street address for shipping.",
"shipping_address_country VARCHAR(100)": "- `shipping_address_city VARCHAR(100)`: City for shipping.",
"shipping_address_postalcode VARCHAR(20)": "- `shipping_address_state VARCHAR(100)`: State/province for shipping.",
"special_instructions TEXT": "- `shipping_address_country VARCHAR(100)`: Country for shipping.",
"created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "- `shipping_address_postalcode VARCHAR(20)`: Postal code for shipping.",
"updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, -- Removed ON UPDATE CURRENT_TIMESTAMP (PostgreSQL does not support it)\n campaign_id INT": "- `special_instructions TEXT`: Any special instructions for the order.",
"CONSTRAINT fk_orders_customer FOREIGN KEY (person_customer_id) REFERENCES customerInfo(person_customer_id) ON DELETE CASCADE, -- Added comma\n CONSTRAINT fk_orders_campaign FOREIGN KEY (campaign_id) REFERENCES campaigns(campaign_id) ON DELETE SET NULL": "- `created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP`: Timestamp indicating when the order record was created. Defaults to the current timestamp."
},
"order_items": {
"order_item_id SERIAL PRIMARY KEY": "This set of columns describes an `order_items` table, likely related to an e-commerce system. It stores details about individual items within an order.",
"order_id INT NOT NULL": "",
"product_id INT NOT NULL": "- `order_item_id`: Unique identifier for each order item, automatically generated.",
"product_name VARCHAR(255) NOT NULL": "- `order_id`: Foreign key linking the item to a specific order.",
"quantity INT": "- `product_id`: Foreign key linking the item to a specific product.",
"price_per_unit NUMERIC(10,2) NOT NULL": "- `product_name`: Name of the product.",
"total_price NUMERIC(10,2) GENERATED ALWAYS AS (quantity * price_per_unit) STORED": "- `quantity`: Number of units of the product ordered.",
"item_status VARCHAR(50)": "- `price_per_unit`: Price of a single unit of the product.",
"warranty_period INT": "- `total_price`: Calculated total price for the item (quantity * price_per_unit).",
"return_period INT": "- `item_status`: Status of the order item (e.g., \"processing,\" \"shipped,\" \"delivered\").",
"is_returnable BOOLEAN DEFAULT TRUE": "- `warranty_period`: Duration of the warranty in a suitable unit (likely days or months).",
"is_replacement_available BOOLEAN DEFAULT FALSE": "- `return_period`: Allowed return duration in a suitable unit (likely days).",
"discount_applied NUMERIC(10,2) DEFAULT 0.00": "- `is_returnable`: Flag indicating if the item is returnable.",
"tax_amount NUMERIC(10,2) DEFAULT 0.00": "- `is_replacement_available`: Flag indicating if replacement is available for the item.",
"shipping_fee NUMERIC(10,2) DEFAULT 0.00": "- `discount_applied`: Discount amount applied to the item.",
"item_weight NUMERIC(10,2), -- in kg\n item_dimensions VARCHAR(100), -- e.g., \"10x5x2 cm\"\n manufacturer VARCHAR(255)": "- `tax_amount`: Tax amount applied to the item.",
"CONSTRAINT fk_order_items_order FOREIGN KEY (order_id) REFERENCES orders(order_id) ON DELETE CASCADE": "- `shipping_fee`: Shipping fee for the item."
},
"events": {
"event_id SERIAL PRIMARY KEY": "These SQL columns define an `events` table designed to capture a wide range of customer interactions and activities on a website or app. Here's a breakdown:",
"person_customer_id INT, -- Links to customerInfo\n order_id INT, -- Links to orders (if event is order-related)\n order_item_id INT, -- Links to order_items (if event is item-specific)\n \n event_type VARCHAR(50) NOT NULL": "",
"device_platform VARCHAR(20)": "* **`event_id SERIAL PRIMARY KEY`**: A unique, auto-incrementing identifier for each event.",
"device_type VARCHAR(50), -- 'Mobile', 'Desktop', 'Tablet', 'POS Machine' (for offline)\n device_browser VARCHAR(100), -- e.g., 'Chrome', 'Safari', 'Firefox', 'Edge'\n device_os VARCHAR(50), -- e.g., 'Windows', 'iOS', 'Android'\n device_app_version VARCHAR(20), -- Stores mobile app version if applicable\n device_ip_address VARCHAR(45), -- Store IPv4 or IPv6\n location_city VARCHAR(100)": "",
"location_country VARCHAR(100)": "* **`person_customer_id`, `order_id`, `order_item_id`, `event_type`**: These columns categorize the event. They link the event to a specific customer, order, or order item, and define the type of event (e.g., 'page view', 'purchase', 'add to cart').",
"session_id VARCHAR(255), -- Unique session tracking for web/app\n referral_source VARCHAR(255), -- Source of visit (Google, Facebook, Direct, etc.)\n utm_campaign VARCHAR(255), -- Marketing campaign tracking\n event_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "",
"-- Additional Engagement Metrics\n page_url TEXT, -- URL of the page visited\n time_spent_seconds INT, -- Time spent on action\n click_count INT DEFAULT 0, -- Number of clicks in an interaction\n scroll_depth_percentage INT, -- How far a user scrolled\n \n -- Order & Cart Interaction Data\n cart_value NUMERIC(10,2), -- Total cart value when event occurred\n payment_method VARCHAR(50)": "* **`device_platform`, `device_type`, `device_browser`, `device_os`, `device_app_version`, `device_ip_address`, `location_city`, `location_country`**: These columns record details about the device and location from which the event originated.",
"discount_applied NUMERIC(10,2) DEFAULT 0.00, -- Discount at the time of order\n\n -- Support & Feedback\n support_ticket_id VARCHAR(50), -- If the event is related to customer support\n review_rating INT, -- User rating for review event\n review_comment TEXT, -- Review content\n return_reason VARCHAR(255), -- Reason for return if applicable\n \n -- Notifications & Promotions\n email_opened BOOLEAN DEFAULT FALSE, -- Whether the user opened an email\n push_notification_clicked BOOLEAN DEFAULT FALSE, -- If a push notification was clicked\n coupon_code_used VARCHAR(50), -- Coupon applied if any\n survey_completed BOOLEAN DEFAULT FALSE, -- If the user completed a survey\n\n event_metadata TEXT, -- Optional field for additional JSON-like details\n\n -- Foreign Keys\n CONSTRAINT fk_events_customer FOREIGN KEY (person_customer_id) REFERENCES customerInfo(person_customer_id) ON DELETE SET NULL": "",
"CONSTRAINT fk_events_order FOREIGN KEY (order_id) REFERENCES orders(order_id) ON DELETE SET NULL": "* **`session_id`, `referral_source`, `utm_campaign`, `event_timestamp`**: These fields provide context about the user's session, how they arrived (referral source and marketing campaign), and when the event occurred.",
"CONSTRAINT fk_events_order_item FOREIGN KEY (order_item_id) REFERENCES order_items(order_item_id) ON DELETE SET NULL": ""
},
"products": {
"unique_product_identifier SERIAL PRIMARY KEY": "This set of columns describes a comprehensive product catalog database. Here's a breakdown:",
"product_display_name VARCHAR(255) NOT NULL": "",
"detailed_product_description TEXT": "**Identification & Categorization:**",
"product_category_primary VARCHAR(100) NOT NULL": "",
"product_category_secondary VARCHAR(100)": "* `unique_product_identifier SERIAL PRIMARY KEY`: Unique, auto-incrementing ID for each product.",
"global_brand_affiliation VARCHAR(100)": "* `product_display_name VARCHAR(255) NOT NULL`: The name displayed to customers.",
"model_identification_code VARCHAR(100)": "* `detailed_product_description TEXT`: A longer description of the product.",
"stock_keeping_unit_identifier VARCHAR(50) UNIQUE": "* `product_category_primary VARCHAR(100) NOT NULL`: Main category the product belongs to.",
"universal_product_code VARCHAR(50) UNIQUE, \n european_article_number VARCHAR(50) UNIQUE, \n international_standard_book_number VARCHAR(50) UNIQUE, \n \n standard_retail_price_including_tax NUMERIC(10,2) NOT NULL": "* `product_category_secondary VARCHAR(100)`: A secondary category for more precise classification.",
"promotional_discounted_price NUMERIC(10,2)": "* `global_brand_affiliation VARCHAR(100)`: The brand associated with the product.",
"percentage_discount_applied DECIMAL(5,2)": "* `model_identification_code VARCHAR(100)`: Specific model number or code.",
"applicable_value_added_tax DECIMAL(5,2)": "* `stock_keeping_unit_identifier VARCHAR(50) UNIQUE`: Unique identifier for inventory management.",
"currency_of_transaction VARCHAR(10) DEFAULT 'USD'": "* `universal_product_code VARCHAR(50) UNIQUE`: UPC barcode identifier.",
"available_stock_quantity_in_units INT NOT NULL": "* `european_article_number VARCHAR(50) UNIQUE`: EAN barcode identifier.",
"minimum_threshold_for_restocking INT": "* `international_standard_book_number VARCHAR(50) UNIQUE`: ISBN for books.",
"estimated_replenishment_date DATE": "",
"associated_supplier_reference_id INT, \n warehouse_storage_location_details VARCHAR(255)": "**Pricing & Tax:**",
"production_batch_identifier VARCHAR(100)": "",
"net_weight_in_kilograms DECIMAL(10,3)": "* `standard_retail_price_including_tax NUMERIC(10,2) NOT NULL`: Standard retail price.",
"physical_length_in_centimeters DECIMAL(10,2)": "* `promotional_discounted_price NUMERIC(10,2)`: Discounted price if applicable.",
"physical_width_in_centimeters DECIMAL(10,2)": "* `percentage_discount_applied DECIMAL(5,2)`: Percentage of discount.",
"physical_height_in_centimeters DECIMAL(10,2)": "* `applicable_value_added_tax DECIMAL(5,2)`: VAT amount.",
"volumetric_measurement_in_liters DECIMAL(10,2)": "* `currency_of_transaction VARCHAR(10) DEFAULT 'USD'`: Currency of the price.",
"predominant_color_description VARCHAR(50)": "",
"designated_size_variation VARCHAR(50)": "**Inventory & Logistics:**",
"primary_material_composition VARCHAR(100)": "",
"stylistic_representation VARCHAR(100)": "* `available_stock_quantity_in_units INT NOT NULL`: Current stock level.",
"intended_user_demographic VARCHAR(20)": "* `minimum_threshold_for_restocking INT`: Reorder point.",
"estimated_battery_backup_duration VARCHAR(50)": "* `estimated_replenishment_date DATE`: Expected date of restock.",
"energy_consumption_rating VARCHAR(50)": "* `associated_supplier_reference_id INT`: Foreign key linking to the `suppliers` table.",
"supported_connectivity_protocols VARCHAR(100)": "* `warehouse_storage_location_details VARCHAR(255)`: Where the product is stored.",
"embedded_processor_specifications VARCHAR(100)": "* `production_batch_identifier VARCHAR(100)`: Identifier for the production batch.",
"integrated_memory_configuration VARCHAR(50)": "* `shipping_weight_measurement_in_kilograms DECIMAL(10,3)`: Weight for shipping calculations.",
"total_storage_capacity_details VARCHAR(50)": "",
"indexed_search_keywords_for_product TEXT": "**Physical Attributes:**",
"optimized_meta_title_for_seo VARCHAR(255)": "",
"search_engine_meta_description TEXT": "* `net_weight_in_kilograms DECIMAL(10,3)`: Weight of the product.",
"product_demonstration_video_link TEXT": "* `physical_length_in_centimeters DECIMAL(10,2)`: Product length.",
"featured_product_flag BOOLEAN DEFAULT FALSE": "* `physical_width_in_centimeters DECIMAL(10,2)`: Product width.",
"aggregate_customer_review_rating DECIMAL(3,2) DEFAULT 0.0": "* `physical_height_in_centimeters DECIMAL(10,2)`: Product height.",
"total_number_of_verified_reviews INT DEFAULT 0": "* `volumetric_measurement_in_liters DECIMAL(10,2)`: Volume of the product.",
"standard_warranty_duration VARCHAR(50)": "* `predominant_color_description VARCHAR(50)`: Main color of the product.",
"comprehensive_return_policy_description TEXT": "* `designated_size_variation VARCHAR(50)`: Available size options.",
"shipping_weight_measurement_in_kilograms DECIMAL(10,3)": "* `primary_material_composition VARCHAR(100)`: Material the product is made of.",
"fragile_item_indicator BOOLEAN DEFAULT FALSE": "",
"perishable_product_flag BOOLEAN DEFAULT FALSE": "**Product Specifics & Marketing:**",
"expected_lead_time_in_business_days INT": "",
"active_product_status BOOLEAN DEFAULT TRUE": "* `stylistic_representation VARCHAR(100)`: Style or design of the product.",
"official_product_release_date DATE": "* `intended_user_demographic VARCHAR(20)`: Target audience.",
"official_product_discontinuation_date DATE": "* `estimated_battery_backup_duration VARCHAR(50)`: Battery life if applicable.",
"legal_manufacturer_entity_name VARCHAR(255)": "* `energy_consumption_rating VARCHAR(50)`: Energy efficiency rating.",
"country_of_product_origin VARCHAR(100)": "* `supported_connectivity_protocols VARCHAR(100)`: Supported connectivity options.",
"estimated_production_cost_per_unit NUMERIC(10,2)": "* `embedded_processor_specifications VARCHAR(100)`: Processor details if applicable.",
"certified_regulatory_compliance_details TEXT": "* `integrated_memory_configuration VARCHAR(50)`: Memory details if applicable.",
"environmentally_sustainable_product BOOLEAN DEFAULT FALSE": "* `total_storage_capacity_details VARCHAR(50)`: Storage capacity if applicable.",
"applicable_warranty_coverage_type VARCHAR(50)": "* `indexed_search_keywords_for_product TEXT`: Keywords for search optimization.",
"CONSTRAINT fk_products_supplier FOREIGN KEY (associated_supplier_reference_id) REFERENCES suppliers(supplier_unique_identifier) ON DELETE SET NULL": "* `optimized_meta_title_for_seo VARCHAR(255)`: SEO title."
},
"customers_loyalty_program": {
"loyalty_membership_unique_identifier SERIAL PRIMARY KEY": "This set of columns describes a table for a loyalty program. Here's a breakdown:",
"associated_customer_reference_id INT NOT NULL": "",
"loyalty_program_tier_level VARCHAR(50)": "* **`loyalty_membership_unique_identifier SERIAL PRIMARY KEY`**: Unique, auto-incrementing ID for each loyalty membership.",
"accumulated_loyalty_points_balance INT DEFAULT 0": "* **`associated_customer_reference_id INT NOT NULL FOREIGN KEY ...`**: Links the loyalty membership to a customer in the `customerInfo` table. Cascading deletes mean deleting a customer also deletes their loyalty membership.",
"last_loyalty_point_update_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* **`loyalty_program_tier_level VARCHAR(50)`**: The customer's current tier in the loyalty program (e.g., \"Gold\", \"Platinum\").",
"eligible_for_special_promotions BOOLEAN DEFAULT FALSE": "* **`accumulated_loyalty_points_balance INT DEFAULT 0`**: Current balance of loyalty points.",
"initial_enrollment_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* **`last_loyalty_point_update_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP`**: Timestamp of the last points balance update.",
"last_loyalty_tier_upgrade_date TIMESTAMP": "* **`eligible_for_special_promotions BOOLEAN DEFAULT FALSE`**: Flag indicating eligibility for special promotions.",
"next_loyalty_tier_evaluation_date TIMESTAMP": "* **`initial_enrollment_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP`**: Date the customer joined the loyalty program.",
"expiration_date_of_loyalty_points TIMESTAMP": "* **`last_loyalty_tier_upgrade_date TIMESTAMP`**: Date of the last tier upgrade.",
"total_discount_amount_redeemed NUMERIC(10,2) DEFAULT 0.00": "* **`next_loyalty_tier_evaluation_date TIMESTAMP`**: Date of the next tier evaluation.",
"lifetime_loyalty_points_earned INT DEFAULT 0": "* **`expiration_date_of_loyalty_points TIMESTAMP`**: When the accumulated points expire.",
"lifetime_loyalty_points_redeemed INT DEFAULT 0": "* **`total_discount_amount_redeemed NUMERIC(10,2) DEFAULT 0.00`**: Total monetary value of discounts redeemed.",
"exclusive_coupon_codes_assigned TEXT": "* **`lifetime_loyalty_points_earned INT DEFAULT 0`**: Total points earned over the lifetime of the membership.",
"customer_birthday_special_discount BOOLEAN DEFAULT FALSE": "* **`lifetime_loyalty_points_redeemed INT DEFAULT 0`**: Total points redeemed over the lifetime of the membership.",
"personalized_product_recommendations JSON": "* **`exclusive_coupon_codes_assigned TEXT`**: Assigned coupon codes.",
"annual_loyalty_spending_threshold NUMERIC(10,2)": "* **`customer_birthday_special_discount BOOLEAN DEFAULT FALSE`**: Eligibility for birthday discounts.",
"free_shipping_eligibility BOOLEAN DEFAULT FALSE": "* **`personalized_product_recommendations JSON`**: Stored personalized product recommendations.",
"anniversary_reward_voucher_status BOOLEAN DEFAULT FALSE": "* **`annual_loyalty_spending_threshold NUMERIC(10,2)`**: Spending threshold for benefits or tier evaluation.",
"customer_feedback_engagement_score DECIMAL(5,2)": "* **`free_shipping_eligibility BOOLEAN DEFAULT FALSE`**: Eligibility for free shipping.",
"bonus_loyalty_points_last_month INT DEFAULT 0": "* **`anniversary_reward_voucher_status BOOLEAN DEFAULT FALSE`**: Status of anniversary reward voucher.",
"referral_bonus_points_earned INT DEFAULT 0": "* **`customer_feedback_engagement_score DECIMAL(5,2)`**: Score based on customer feedback engagement.",
"referred_friends_count INT DEFAULT 0": "* **`bonus_loyalty_points_last_month INT DEFAULT 0`**: Bonus points earned last month.",
"extra_reward_credits_from_surveys INT DEFAULT 0": "* **`referral_bonus_points_earned INT DEFAULT 0`**: Points earned from referrals.",
"special_event_invitation_status BOOLEAN DEFAULT FALSE": "* **`referred_friends_count INT DEFAULT 0`**: Number of friends referred.",
"redemption_activity_log JSON": "* **`extra_reward_credits_from_surveys INT DEFAULT 0`**: Credits earned from surveys.",
"last_redemption_date TIMESTAMP": "* **`special_event_invitation_status BOOLEAN DEFAULT FALSE`**: Invitation status for special events.",
"preferred_communication_channel VARCHAR(50)": "* **`redemption_activity_log JSON`**: Log of redemption activity.",
"participation_in_exclusive_beta_testing BOOLEAN DEFAULT FALSE": "* **`last_redemption_date TIMESTAMP`**: Date of the last redemption.",
"exclusive_member_early_access BOOLEAN DEFAULT FALSE": "* **`preferred_communication_channel VARCHAR(50)`**: Customer's preferred communication channel.",
"FOREIGN KEY (associated_customer_reference_id) REFERENCES customerInfo(person_customer_id) ON DELETE CASCADE": "* **`participation_in_exclusive_beta_testing BOOLEAN DEFAULT FALSE`**: Participation in beta testing programs."
},
"product_reviews_and_ratings": {
"review_unique_identifier SERIAL PRIMARY KEY": "This SQL schema describes a table for storing customer reviews.",
"referenced_product_identifier INT NOT NULL": "",
"reviewing_customer_identifier INT NOT NULL": "* `review_unique_identifier`: A unique, automatically incrementing integer serving as the primary key for each review.",
"customer_review_submission_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* `referenced_product_identifier`: Foreign key referencing the product being reviewed. Deletes cascade from the `products` table.",
"textual_review_feedback TEXT": "* `reviewing_customer_identifier`: Foreign key referencing the customer who wrote the review. Sets to null if the customer is deleted from the `customerInfo` table.",
"submitted_review_star_rating DECIMAL(3,2) DEFAULT 0.00": "* `customer_review_submission_date`: Timestamp of when the review was submitted, defaults to the current time.",
"verification_status_of_reviewer BOOLEAN DEFAULT FALSE": "* `textual_review_feedback`: The actual text content of the review.",
"number_of_helpful_votes_received INT DEFAULT 0": "* `submitted_review_star_rating`: The star rating given by the customer (e.g., 4.50).",
"flagged_as_inappropriate BOOLEAN DEFAULT FALSE": "* `verification_status_of_reviewer`: Indicates if the reviewer has been verified as a genuine purchaser.",
"contains_multimedia_content BOOLEAN DEFAULT FALSE": "* `number_of_helpful_votes_received`: Count of helpful votes received by the review.",
"associated_review_image_urls TEXT": "* `flagged_as_inappropriate`: Indicates if the review has been flagged as inappropriate.",
"associated_review_video_links TEXT": "* `contains_multimedia_content`: Indicates if the review contains images or videos.",
"sentiment_analysis_score DECIMAL(5,2)": "* `associated_review_image_urls`: URLs of images associated with the review.",
"keywords_extracted_from_review TEXT": "* `associated_review_video_links`: URLs of videos associated with the review.",
"length_of_review_in_characters INT": "* `sentiment_analysis_score`: Score representing the sentiment (positive, negative, neutral) of the review.",
"previous_product_purchases_count INT DEFAULT 0": "* `keywords_extracted_from_review`: Keywords extracted from the review text.",
"return_request_status BOOLEAN DEFAULT FALSE": "* `length_of_review_in_characters`: Character count of the review.",
"response_from_brand_or_seller TEXT": "* `previous_product_purchases_count`: Number of times the reviewer has purchased the product previously.",
"response_submission_date TIMESTAMP": "* `return_request_status`: Indicates if the reviewer requested a return for the product.",
"additional_comments_by_other_users JSON": "* `response_from_brand_or_seller`: Response to the review from the brand or seller.",
"user_has_edited_review BOOLEAN DEFAULT FALSE": "* `response_submission_date`: Timestamp of when the brand/seller response was submitted.",
"total_number_of_edits_made INT DEFAULT 0": "* `additional_comments_by_other_users`: JSON field for comments from other users about the review.",
"review_approval_moderation_status VARCHAR(50)": "* `user_has_edited_review`: Indicates if the review has been edited by the user.",
"review_moderator_notes TEXT": "* `total_number_of_edits_made`: Number of times the review has been edited.",
"FOREIGN KEY (referenced_product_identifier) REFERENCES products(unique_product_identifier) ON DELETE CASCADE": "* `review_approval_moderation_status`: Status of the review's moderation approval (e.g., \"approved\", \"pending\", \"rejected\").",
"FOREIGN KEY (reviewing_customer_identifier) REFERENCES customerInfo(person_customer_id) ON DELETE SET NULL": "* `review_moderator_notes`: Notes from the moderator about the review."
},
"transactions_and_payments": {
"transaction_unique_identifier SERIAL PRIMARY KEY": "This SQL schema describes a table for storing transaction details. Here's a breakdown of each column:",
"linked_order_reference_identifier INT NOT NULL": "",
"corresponding_customer_reference_identifier INT NOT NULL": "**Identifiers & Links:**",
"total_transaction_amount NUMERIC(10,2) NOT NULL": "",
"applied_discount_value NUMERIC(10,2) DEFAULT 0.00": "* `transaction_unique_identifier SERIAL PRIMARY KEY`: Unique, auto-incrementing ID for each transaction.",
"final_billed_amount NUMERIC(10,2) NOT NULL": "* `linked_order_reference_identifier INT NOT NULL`: Foreign key linking to the `orders` table. Cascading delete means deleting an order will delete associated transactions.",
"transaction_status VARCHAR(50)": "* `corresponding_customer_reference_identifier INT NOT NULL`: Foreign key linking to the `customerInfo` table. Setting to NULL on customer deletion preserves transaction data.",
"transaction_date_and_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "",
"payment_method_used VARCHAR(50)": "",
"payment_gateway_used VARCHAR(100)": "**Transaction Amounts & Status:**",
"transaction_authorization_code VARCHAR(100)": "",
"billing_address_street VARCHAR(255)": "* `total_transaction_amount NUMERIC(10,2) NOT NULL`: The original total amount of the transaction.",
"billing_address_city VARCHAR(100)": "* `applied_discount_value NUMERIC(10,2) DEFAULT 0.00`: Amount of discount applied.",
"billing_address_state VARCHAR(100)": "* `final_billed_amount NUMERIC(10,2) NOT NULL`: The final amount charged after discounts.",
"billing_address_country VARCHAR(100)": "* `transaction_status VARCHAR(50)`: Status of the transaction (e.g., \"Completed,\" \"Pending,\" \"Failed\").",
"billing_address_zip_code VARCHAR(20)": "* `transaction_date_and_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP`: Timestamp of the transaction.",
"shipping_address_street VARCHAR(255)": "",
"shipping_address_city VARCHAR(100)": "",
"shipping_address_state VARCHAR(100)": "**Payment Information:**",
"shipping_address_country VARCHAR(100)": "",
"shipping_address_zip_code VARCHAR(20)": "* `payment_method_used VARCHAR(50)`: The payment method used (e.g., \"Credit Card,\" \"PayPal\").",
"transaction_currency_code VARCHAR(10) DEFAULT 'USD'": "* `payment_gateway_used VARCHAR(100)`: The payment gateway used (e.g., \"Stripe,\" \"Authorize.net\").",
"foreign_exchange_conversion_rate DECIMAL(10,4)": "* `transaction_authorization_code VARCHAR(100)`: Authorization code from the payment gateway.",
"refund_status BOOLEAN DEFAULT FALSE": "* `transaction_currency_code VARCHAR(10) DEFAULT 'USD'`: Currency of the transaction.",
"refund_initiation_date TIMESTAMP": "* `foreign_exchange_conversion_rate DECIMAL(10,4)`: Exchange rate if different from the base currency.",
"refund_amount NUMERIC(10,2)": "* `digital_wallet_used VARCHAR(50)`: If a digital wallet was used (e.g., \"Apple Pay,\" \"Google Pay\").",
"chargeback_request_status BOOLEAN DEFAULT FALSE": "* `cryptocurrency_payment_flag BOOLEAN DEFAULT FALSE`: Indicates if cryptocurrency was used.",
"chargeback_dispute_reason TEXT": "* `cryptocurrency_type VARCHAR(50)`: Type of cryptocurrency used (e.g., \"Bitcoin,\" \"Ethereum\").",
"chargeback_resolution_status VARCHAR(50)": "* `alternative_payment_method_used VARCHAR(50)`: Other alternative payment methods.",
"associated_loyalty_points_earned INT DEFAULT 0": "",
"gift_card_or_store_credit_usage BOOLEAN DEFAULT FALSE": "",
"applied_gift_card_code VARCHAR(50)": "**Addressing:**",
"recurring_billing_flag BOOLEAN DEFAULT FALSE": "",
"installment_payment_status BOOLEAN DEFAULT FALSE": "* `billing_address_street`, `billing_address_city`, `billing_address_state`, `billing_address_country`, `billing_address_zip_code`: Billing address details.",
"first_time_customer_transaction BOOLEAN DEFAULT FALSE": "* `shipping_address_street`, `shipping_address_city`, `shipping_address_state`, `shipping_address_country`, `shipping_address_zip_code`: Shipping address details.",
"transaction_frequency_category VARCHAR(50)": "",
"digital_wallet_used VARCHAR(50)": "",
"cryptocurrency_payment_flag BOOLEAN DEFAULT FALSE": "**Refunds & Chargebacks:**",
"cryptocurrency_type VARCHAR(50)": "",
"alternative_payment_method_used VARCHAR(50)": "* `refund_status BOOLEAN DEFAULT FALSE`: Indicates if a refund has been issued.",
"promotional_offer_applied BOOLEAN DEFAULT FALSE": "* `refund_initiation_date TIMESTAMP`: Date and time the refund was initiated.",
"special_financing_option_used BOOLEAN DEFAULT FALSE": "* `refund_amount NUMERIC(10,2)`: Amount refunded.",
"customer_feedback_on_transaction TEXT": "* `chargeback_request_status BOOLEAN DEFAULT FALSE`: Indicates if a chargeback has been requested.",
"transaction_review_score DECIMAL(3,2)": "* `chargeback_dispute_reason TEXT`: Reason for the chargeback dispute.",
"is_transaction_fraudulent BOOLEAN DEFAULT FALSE": "* `chargeback_resolution_status VARCHAR(50)`: Status of the chargeback resolution.",
"fraud_detection_flagged BOOLEAN DEFAULT FALSE": "",
"fraud_detection_notes TEXT": "",
"FOREIGN KEY (linked_order_reference_identifier) REFERENCES orders(order_id) ON DELETE CASCADE": "**Other Transaction Details:**",
"FOREIGN KEY (corresponding_customer_reference_identifier) REFERENCES customerInfo(person_customer_id) ON DELETE SET NULL": ""
},
"inventory": {
"id SERIAL PRIMARY KEY": "This set of columns likely describes an inventory management table.",
"referenced_product_id INT NOT NULL": "",
"quantity INT NOT NULL": "* **`id SERIAL PRIMARY KEY`**: Unique, automatically incrementing identifier for each inventory record.",
"last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* **`referenced_product_id INT NOT NULL`**: Foreign key referencing the product this record pertains to. Cascading deletes are enabled.",
"warehouse_location VARCHAR(255)": "* **`quantity INT NOT NULL`**: Current quantity of the product in stock.",
"stock_threshold INT DEFAULT 10": "* **`last_updated TIMESTAMP DEFAULT CURRENT_TIMESTAMP`**: Timestamp indicating the last time this record was modified. Defaults to the current time.",
"safety_stock INT DEFAULT 5": "* **`warehouse_location VARCHAR(255)`**: Location of the product within the warehouse.",
"supplier_id INT": "* **`stock_threshold INT DEFAULT 10`**: The quantity at which a restock should be triggered. Defaults to 10.",
"last_restock_date TIMESTAMP": "* **`safety_stock INT DEFAULT 5`**: Minimum quantity to be maintained to avoid stockouts. Defaults to 5.",
"expected_restock_date TIMESTAMP": "* **`supplier_id INT`**: Foreign key referencing the supplier of this product. Setting to NULL on supplier deletion.",
"purchase_price NUMERIC(10,2)": "* **`last_restock_date TIMESTAMP`**: Date of the last restock.",
"bulk_discount NUMERIC(10,2) DEFAULT 0.00": "* **`expected_restock_date TIMESTAMP`**: Expected date of the next restock.",
"storage_temperature VARCHAR(50)": "* **`purchase_price NUMERIC(10,2)`**: Price at which the product was purchased.",
"shelf_life INT": "* **`bulk_discount NUMERIC(10,2) DEFAULT 0.00`**: Discount applied for bulk purchases. Defaults to 0.",
"batch_number VARCHAR(50)": "* **`storage_temperature VARCHAR(50)`**: Required storage temperature for the product.",
"expiry_date DATE": "* **`shelf_life INT`**: Shelf life of the product (likely in days or a similar unit).",
"stock_status VARCHAR(50) DEFAULT 'Available'": "* **`batch_number VARCHAR(50)`**: Batch number of the product.",
"last_inventory_audit_date TIMESTAMP": "* **`expiry_date DATE`**: Expiration date of the product.",
"inventory_adjustment_reason TEXT": "* **`stock_status VARCHAR(50) DEFAULT 'Available'`**: Current status of the stock (e.g., Available, Out of Stock, Backordered). Defaults to 'Available'.",
"damaged_stock INT DEFAULT 0": "* **`last_inventory_audit_date TIMESTAMP`**: Date of the last inventory audit.",
"inbound_shipment_tracking VARCHAR(100)": "* **`inventory_adjustment_reason TEXT`**: Reason for any adjustments made to the inventory.",
"outbound_shipment_tracking VARCHAR(100)": "* **`damaged_stock INT DEFAULT 0`**: Quantity of damaged stock. Defaults to 0.",
"inventory_turnover_rate DECIMAL(10,2) GENERATED ALWAYS AS \n (quantity / NULLIF(safety_stock, 0)) STORED": "* **`inbound_shipment_tracking VARCHAR(100)`**: Tracking number for inbound shipments.",
"last_sold_date TIMESTAMP": "* **`outbound_shipment_tracking VARCHAR(100)`**: Tracking number for outbound shipments.",
"FOREIGN KEY (referenced_product_id) REFERENCES products(unique_product_identifier) ON DELETE CASCADE": "* **`inventory_turnover_rate DECIMAL(10,2) GENERATED ALWAYS AS (quantity / NULLIF(safety_stock, 0)) STORED`**: Calculated field representing the inventory turnover rate. Stored persistently.",
"FOREIGN KEY (supplier_id) REFERENCES suppliers(supplier_unique_identifier) ON DELETE SET NULL": "* **`last_sold_date TIMESTAMP`**: Date when the product was last sold."
},
"shipping": {
"id SERIAL PRIMARY KEY": "This set of columns likely describes a table for storing shipment information related to orders.",
"fk_order_id INT NOT NULL": "",
"shipping_address TEXT NOT NULL": "- `id SERIAL PRIMARY KEY`: A unique, auto-incrementing integer that serves as the primary key for this table. Each shipment gets a unique ID.",
"shipping_city VARCHAR(100) NOT NULL": "- `fk_order_id INT NOT NULL`: A foreign key linking this shipment to an order in the `orders` table. It's required and ensures every shipment is associated with an order.",
"shipping_state VARCHAR(100) NOT NULL": "- `shipping_address TEXT NOT NULL`: The street address for the shipment (required).",
"shipping_zipcode VARCHAR(20) NOT NULL": "- `shipping_city VARCHAR(100) NOT NULL`: The city for the shipment (required).",
"shipping_country VARCHAR(100) NOT NULL": "- `shipping_state VARCHAR(100) NOT NULL`: The state/province/region for the shipment (required).",
"shipping_status VARCHAR(50) CHECK (shipping_status IN ('Pending', 'Shipped', 'Delivered', 'Cancelled'))": "- `shipping_zipcode VARCHAR(20) NOT NULL`: The postal/zip code for the shipment (required).",
"tracking_number VARCHAR(255) UNIQUE": "- `shipping_country VARCHAR(100) NOT NULL`: The country for the shipment (required).",
"estimated_delivery DATE": "- `shipping_status VARCHAR(50) CHECK (shipping_status IN ('Pending', 'Shipped', 'Delivered', 'Cancelled'))`: The current status of the shipment, restricted to one of four predefined values (required).",
"shipped_date TIMESTAMP": "- `tracking_number VARCHAR(255) UNIQUE`: A unique tracking number for the shipment (optional, but must be unique if provided).",
"carrier VARCHAR(100)": "- `estimated_delivery DATE`: The estimated delivery date (optional).",
"shipping_cost DECIMAL(10,2) CHECK (shipping_cost >= 0)": "- `shipped_date TIMESTAMP`: The date and time the shipment was shipped (optional).",
"FOREIGN KEY (fk_order_id) REFERENCES orders(order_id) ON DELETE CASCADE": "- `carrier VARCHAR(100)`: The name of the shipping carrier (optional)."
},
"cart": {
"id SERIAL PRIMARY KEY": "This looks like a schema for a shopping cart or order item table. Here's a breakdown of the columns:",
"fk_user_id INT NOT NULL": "",
"fk_product_id INT NOT NULL": "* **`id SERIAL PRIMARY KEY`**: Unique identifier for each cart item/order item. Auto-incrementing.",
"quantity INT NOT NULL DEFAULT 1": "* **`fk_user_id INT NOT NULL`**: Foreign key referencing the customer who owns the cart/placed the order.",
"price_per_unit NUMERIC(10,2) NOT NULL": "* **`fk_product_id INT NOT NULL`**: Foreign key referencing the product in the cart/order.",
"total_price NUMERIC(10,2), -- Will be updated via trigger\n discount_applied NUMERIC(10,2) DEFAULT 0.00": "* **`quantity INT NOT NULL DEFAULT 1`**: Number of units of the product in the cart/order. Defaults to 1.",
"coupon_code VARCHAR(50)": "* **`price_per_unit NUMERIC(10,2) NOT NULL`**: Price of a single unit of the product.",
"discounted_total_price NUMERIC(10,2), -- Will be updated via trigger\n cart_status VARCHAR(20) DEFAULT 'active'": "* **`total_price NUMERIC(10,2)`**: Total price for this item (quantity * price_per_unit), likely calculated and updated by a trigger.",
"session_id VARCHAR(255)": "* **`discount_applied NUMERIC(10,2) DEFAULT 0.00`**: Amount of discount applied to this item.",
"last_activity_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* **`coupon_code VARCHAR(50)`**: Coupon code used for the item, if any.",
"tax_amount NUMERIC(10,2) DEFAULT 0.00": "* **`discounted_total_price NUMERIC(10,2)`**: Total price after applying discounts, likely calculated by a trigger.",
"shipping_fee NUMERIC(10,2) DEFAULT 0.00": "* **`cart_status VARCHAR(20) DEFAULT 'active'`**: Status of the cart item (e.g., active, purchased, removed).",
"estimated_delivery_date DATE": "* **`session_id VARCHAR(255)`**: Identifier for the user's session, useful for anonymous users.",
"is_gift BOOLEAN DEFAULT FALSE": "* **`last_activity_timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP`**: Timestamp of the last activity related to this cart item.",
"gift_message TEXT": "* **`tax_amount NUMERIC(10,2) DEFAULT 0.00`**: Tax applied to the item.",
"recommended_products JSON": "* **`shipping_fee NUMERIC(10,2) DEFAULT 0.00`**: Shipping fee for the item.",
"wishlist_flag BOOLEAN DEFAULT FALSE": "* **`estimated_delivery_date DATE`**: Estimated delivery date for the item.",
"abandonment_reason VARCHAR(255)": "* **`is_gift BOOLEAN DEFAULT FALSE`**: Indicates whether the item is a gift.",
"added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* **`gift_message TEXT`**: Gift message associated with the item, if any.",
"FOREIGN KEY (fk_user_id) REFERENCES customerInfo(person_customer_id) ON DELETE CASCADE": "* **`recommended_products JSON`**: Potentially stores recommended products related to this item.",
"FOREIGN KEY (fk_product_id) REFERENCES products(unique_product_identifier) ON DELETE CASCADE": "* **`wishlist_flag BOOLEAN DEFAULT FALSE`**: Indicates if the item is added to a wishlist."
},
"wishlist": {
"id SERIAL PRIMARY KEY": "This SQL schema describes a table likely named `wishlist` to store user product wishlists.",
"fk_user_id INT NOT NULL": "",
"fk_product_id INT NOT NULL": "- `id SERIAL PRIMARY KEY`: A unique, auto-incrementing integer that serves as the primary key for each wishlist item.",
"product_name VARCHAR(255), -- Stores the product name\n price_at_addition DECIMAL(10,2), -- Price when added to wishlist\n discount_at_addition DECIMAL(10,2), -- Discount applied at the time of addition\n wishlist_status wishlist_status_enum DEFAULT 'active', -- Tracks status of wishlist item\n priority_level priority_level_enum DEFAULT 'medium', -- Priority of wishlist item\n expected_purchase_date DATE, -- Expected purchase date if user sets one\n quantity INT DEFAULT 1, -- Number of units user wants\n notes TEXT, -- User notes regarding the item\n reminder_set BOOLEAN DEFAULT FALSE, -- Whether a reminder is set\n reminder_date TIMESTAMP, -- Reminder date for purchase\n last_viewed_at TIMESTAMP, -- When user last viewed this item in wishlist\n added_from_source added_from_source_enum, -- Source of addition\n stock_status_at_addition BOOLEAN DEFAULT TRUE, -- Whether item was in stock at addition\n category VARCHAR(255), -- Product category\n brand_name VARCHAR(255), -- Brand name of the product\n session_id VARCHAR(255), -- Session ID for tracking user behavior\n currency VARCHAR(10) DEFAULT 'USD', -- Currency type\n added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "- `fk_user_id INT NOT NULL`: A foreign key referencing the `customerInfo` table, linking the wishlist item to a specific user.",
"FOREIGN KEY (fk_user_id) REFERENCES customerInfo(person_customer_id) ON DELETE CASCADE": "- `fk_product_id INT NOT NULL`: A foreign key referencing the `products` table, linking the wishlist item to a specific product.",
"FOREIGN KEY (fk_product_id) REFERENCES products(unique_product_identifier) ON DELETE CASCADE": "- `product_name VARCHAR(255)` through `added_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP`: These columns store various details about the wishlist item, including product information (name, price, discount, category, brand), user preferences (quantity, notes, priority, expected purchase date, reminders), tracking information (status, source, last viewed, session ID, currency), and timestamps."
},
"refunds_returns": {
"id SERIAL PRIMARY KEY": "This set of columns describes a table likely named something like \"returns\" or \"refund_requests,\" designed to track product returns and refund requests. Let's break down each column:",
"fk_user_id INT NOT NULL": "",
"fk_order_id INT NOT NULL": "* **`id SERIAL PRIMARY KEY`**: A unique, automatically incrementing integer that serves as the primary key for this table. It uniquely identifies each return/refund request.",
"fk_product_id INT NOT NULL": "",
"reason TEXT NOT NULL": "* **`fk_user_id INT NOT NULL`**: A foreign key referencing the `customerInfo` table, linking the return/refund request to a specific customer. `NOT NULL` enforces that every return must be associated with a customer.",
"status VARCHAR(50) CHECK (status IN ('Pending', 'Approved', 'Rejected', 'Processed'))": "",
"request_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP": "* **`fk_order_id INT NOT NULL`**: A foreign key referencing the `orders` table, connecting the return/refund request to a specific order. `NOT NULL` ensures every return is tied to an order.",
"processed_date TIMESTAMP, -- Date when refund/return was processed\n refund_amount DECIMAL(10,2), -- Amount refunded to the user\n refund_method VARCHAR(50) CHECK (refund_method IN ('Original Payment Method', 'Store Credit', 'Bank Transfer')), -- Refund method\n return_type VARCHAR(50) CHECK (return_type IN ('Full Return', 'Partial Return', 'Exchange')), -- Type of return\n tracking_number VARCHAR(255), -- Tracking number for return shipment\n shipping_carrier VARCHAR(255), -- Carrier handling return shipping\n restocking_fee DECIMAL(10,2) DEFAULT 0.00, -- Any restocking fees deducted from refund\n return_condition VARCHAR(50) CHECK (return_condition IN ('New', 'Used', 'Damaged', 'Defective')), -- Condition of the returned item\n customer_notes TEXT, -- Notes from the customer about the return\n admin_notes TEXT, -- Notes from the admin handling the return\n refund_status VARCHAR(50) CHECK (refund_status IN ('Initiated', 'In Progress', 'Completed', 'Failed')), -- Status of the refund process\n return_label_url TEXT, -- URL for downloading the return shipping label\n is_refundable BOOLEAN DEFAULT TRUE, -- Whether the product is eligible for a refund\n refund_initiated_by VARCHAR(50) CHECK (refund_initiated_by IN ('Customer', 'Admin', 'System')), -- Who initiated the refund\n FOREIGN KEY (fk_user_id) REFERENCES customerInfo(person_customer_id) ON DELETE CASCADE": "",
"FOREIGN KEY (fk_order_id) REFERENCES orders(order_id) ON DELETE CASCADE": "* **`fk_product_id INT NOT NULL`**: A foreign key referencing the `products` table, indicating which product is being returned. `NOT NULL` mandates that each return specifies a product.",
"FOREIGN KEY (fk_product_id) REFERENCES products(unique_product_identifier) ON DELETE CASCADE": ""
}
}