Cart
Cart
Session_id Payment_id
Modified_at Modified_at
order_details:
SKU Last_name
Status
Created_at
Modified_at
- Relationship: `Cart_Item` has a foreign key `Session_id` that references the primary key `Session_id`
in the `Session` table. This implies that cart items are associated with a specific session, likely indicating
items added to a cart during a user session.
- Relationship: `Order_Details` has a foreign key `User_id` that references the primary key `User_id` in
the `Users` table. This indicates that order details are associated with a particular user who placed the
order.
- Relationship: `Order_Details` has a foreign key `Payment_id` that references the primary key
`Payment_id` in the `Payment_Details` table. This connection suggests that order details are linked to
specific payment information for that order.
- Relationship: `Order_Items` has a foreign key `Order_id` that references the primary key `Order_id` in
the `Order_Details` table. This indicates that order items are associated with a specific order.
- Relationship: `Payment_Details` has a foreign key `Order_id` that references the primary key
`Order_id` in the `Order_Details` table. This suggests that payment details are linked to specific orders.
- Relationship: `Product` has a primary key `Product_id` which is referenced as a foreign key
`Product_id` in the `Order_Items` table. This relationship signifies that products are associated with
items within orders.
8. Session andUsers:
- Relationship: `Session` has a foreign key `User_id` that references the primary key `User_id` in the
`Users` table. This suggests that sessions are related to specific users.
1. Product Table: Contains details about the available products, such as product name, image,
description, SKU (Stock Keeping Unit), category, price, available units, sold units, and timestamps for
creation and modification. It stores all the product-related information necessary for displaying items in
the store.
2. Cart_Item Table: Manages items added to a user's cart during a session. It records the products added,
their quantity, and timestamps for creation and modification. This table is vital for handling the shopping
cart functionality.
3. Session Table: Tracks user sessions and associates them with specific users. It helps in maintaining user
activity during their visit to the online store, including their cart items and timestamps for creation and
modification.
4. Users Table: Stores user information like name, email, password, contact details, address, status, and
timestamps for creation and modification. It keeps track of registered users who can make purchases and
interact with the online store.
5. Order_Details and Order_Items Tables: These tables are crucial for managing orders. Order_Details
contains information about orders, such as the user who placed the order, total amount, timestamps,
and more. Order_Items details the items within each order, linking to the products and orders they
belong to, along with timestamps for creation and modification.
To find the best-selling products, you can use queries that aggregate data from the `Order_Items` table
and sum the quantities sold for each product. By grouping by `Product_id` and summing `Quantity` for
each product, you can identify the products with the highest total quantity sold.
Most Active Users/Transactions:
To identify the most active users or those with the highest transaction count, you can query the `Users`
table and join it with the `Order_Details` table using the `User_id`. Grouping by `User_id` and counting
the number of transactions/orders made by each user will help find the most active users.
- Revenue Generation: Calculate total revenue by summing up the `Amount` from `Payment_Details`.
- Inventory Management: Track available units in the `Product` table and deduct sold units from available
units to manage inventory.
- User Behavior Analysis: Analyze session data in the `Session` table to understand user behavior, like
session duration, frequently viewed products, etc.