Designing a database schema for an online merch store involves considering various entities, their relationships, and attributes. Below is a simplified example of a database schema for an online merch store:
Entities and their attributes:
Customers
CustomerID (Primary Key)
FirstName
LastName
Email
Password (Hashed and Salted)
Address
City
State
ZipCode
Country
Products
ProductID (Primary Key)
Name
Description
Price
Category
Brand
StockQuantity
Orders
OrderID (Primary Key)
CustomerID (Foreign Key to Customers table)
OrderDate
TotalAmount
OrderItems
OrderItemID (Primary Key)
OrderID (Foreign Key to Orders table)
ProductID (Foreign Key to Products table)
Quantity
ItemPrice
Payments
PaymentID (Primary Key)
OrderID (Foreign Key to Orders table)
PaymentDate
Amount
PaymentMethod
TransactionID
Reviews
ReviewID (Primary Key)
ProductID (Foreign Key to Products table)
CustomerID (Foreign Key to Customers table)
Rating (e.g., 1 to 5 stars)
Comment
ReviewDate
Categories
CategoryID (Primary Key)
Name
Brands
BrandID (Primary Key)
Name
Description
Cart
CartID (Primary Key)
CustomerID (Foreign Key to Customers table)
CartItems
CartItemID (Primary Key)
CartID (Foreign Key to Cart table)
ProductID (Foreign Key to Products table)
Quantity
Tags
Database strategy