Database Instruction For E Commerce Website
Database Instruction For E Commerce Website
Users
Attribute Data Type
user_id INT (Primary Key, Auto Increment)
user_type VARCHAR(50)
first_name VARCHAR(50)
last_name VARCHAR(50)
email VARCHAR(100) (Unique)
password VARCHAR(255)
phone_number VARCHAR(20)
address_line1 VARCHAR(100)
address_line2 VARCHAR(100)
city VARCHAR(50)
state VARCHAR(50)
postal_code VARCHAR(20)
country VARCHAR(50)
created_at DATETIME
updated_at DATETIME
Products
Attribute Data Type
product_id INT (Primary Key, Auto Increment)
name VARCHAR(100)
description TEXT
price DECIMAL(10, 2)
stock_quantity INT
category_id INT (Foreign Key to Categories)
brand_id INT (Foreign Key to Brands)
size VARCHAR(10)
color VARCHAR(50)
material VARCHAR(50)
gender VARCHAR(20)
created_at DATETIME
updated_at DATETIME
Categories
Attribute Data Type
category_id INT (Primary Key, Auto Increment)
category_name VARCHAR(100)
parent_category_i INT (Self-referencing Foreign Key)
d
created_at DATETIME
updated_at DATETIME
Brands
Attribute Data Type
brand_id INT (Primary Key, Auto Increment)
brand_nam VARCHAR(100)
e
created_at DATETIME
updated_at DATETIME
Orders
Attribute Data Type
order_id INT (Primary Key, Auto Increment)
user_id INT (Foreign Key to Users)
order_status VARCHAR(50)
total_amount DECIMAL(10, 2)
payment_method VARCHAR(50)
shipping_address VARCHAR(255)
billing_address VARCHAR(255)
created_at DATETIME
updated_at DATETIME
Order_Items
Attribute Data Type
order_item_id INT (Primary Key, Auto Increment)
order_id INT (Foreign Key to Orders)
product_id INT (Foreign Key to Products)
quantity INT
price DECIMAL(10, 2)
total_price DECIMAL(10, 2)
created_at DATETIME
updated_at DATETIME
Shopping_Cart
Attribute Data Type
cart_id INT (Primary Key, Auto Increment)
user_id INT (Foreign Key to Users)
created_at DATETIME
updated_at DATETIME
Cart_Items
Attribute Data Type
cart_item_i INT (Primary Key, Auto Increment)
d
cart_id INT (Foreign Key to Shopping_Cart)
product_id INT (Foreign Key to Products)
quantity INT
created_at DATETIME
updated_at DATETIME