DATA DICTIONARY
1. USER TABLE
Field Name Data Type Description Constraints
userID INT A unique identifier for each user. Primary Key (PK)
name VARCHAR The full name of the user. Not Null
The user's email address, used for login and
email VARCHAR Not Null, Unique
communication.
password VARCHAR Hashed password for user authentication. Not Null
Specifies the role, e.g., 'Customer',
user_type ENUM Not Null
'Administrator'.
2. CUSTOMER TABLE
Field Name Data Type Description Constraints
customerID INT A unique identifier for the customer record. Primary Key (PK)
Foreign Key (FK)
userID INT Links to the main User table.
→ User.userID
address TEXT The default shipping or billing address.
A list of desired products (JSON or separate
wishlist TEXT
table).
3. PRODUCT CATALOG
Field Name Data Type Description Constraints
productID INT A unique identifier for each product. Primary Key (PK)
name VARCHAR The name of the product. Not Null
description TEXT A detailed description of the product.
price DECIMAL The selling price of the product. Not Null, > 0
stock INT The current quantity available. Not Null, ≥ 0
Foreign Key (FK)
categoryID INT Links the product to its category. → Category.
categoryID
4. CATEGORY TABLE
Field Name Data Type Description Constraints
categoryID INT A unique identifier for each category. Primary Key (PK)
The name of the category (e.g., "Power Tools",
name VARCHAR Not Null, Unique
"Safety").
5. REVIEW TABLE
Field Name Data Type Description Constraints
reviewID INT A unique identifier for each review. Primary Key (PK)
Foreign Key (FK)
productID INT The product being reviewed. → Product.
productID
Foreign Key (FK)
userID INT The customer who wrote the review.
→ User.userID
Not Null, CHECK
rating INT Numerical rating (1–5). (rating BETWEEN
1 AND 5)
comment TEXT Text content of the review.
DEFAULT
review_date DATETIME Timestamp when review submitted. CURRENT_TIMES
TAMP
ORDERING AND TRANSACTIONS
6. Shopping Cart Table
Field Name Data Type Description Constraints
cartID INT A unique identifier for each shopping cart. Primary Key (PK)
Foreign Key (FK)
customerID INT The customer who owns this cart. → Customer.
customerID
DEFAULT
created_at DATETIME When the cart was created. CURRENT_TIMES
TAMP
7. Cart Item Table
Field Name Data Type Description Constraints
cartItemID INT A unique identifier for each item in a cart. Primary Key (PK)
Foreign Key (FK)
cartID INT Links item to a specific ShoppingCart. → ShoppingCart.
cartID
Foreign Key (FK)
productID INT The product added to the cart. → Product.
productID
quantity INT Number of units of the product. Not Null, > 0
8. Order Table
Field Name Data Type Description Constraints
orderID INT A unique identifier for each order. Primary Key (PK)
Foreign Key (FK)
customerID INT The customer who placed the order. → Customer.
customerID
DEFAULT
order_date DATETIME When the order was placed. CURRENT_TIMES
TAMP
status VARCHAR Order status (Pending, Shipped, Delivered). Not Null
total_amount DECIMAL Final amount paid. Not Null
9. OrderDetail Table
Field Name Data Type Description Constraints
orderDetailID INT Unique identifier for each line item. Primary Key (PK)
Foreign Key (FK)
orderID INT Links to a specific Order.
→ Order.orderID
Foreign Key (FK)
productID INT Product that was ordered. → Product.
productID
quantity INT Quantity of product ordered. Not Null, > 0
price DECIMAL Price of product at purchase time. Not Null
10. Payment Table
Field Name Data Type Description Constraints
paymentID INT Unique identifier for each payment. Primary Key (PK)
Foreign Key (FK)
orderID INT Order this payment is for.
→ Order.orderID
DEFAULT
payment_date DATETIME Timestamp of payment. CURRENT_TIMES
TAMP
payment_metho
VARCHAR Method (Credit Card, PayPal, etc.). Not Null
d
status VARCHAR Payment status (Completed, Failed). Not Null
details TEXT Transaction ID or gateway details.