Data modeling - Example application
The purpose of this exercise is not to teach data modeling, but just to get you familiarized with the data modeling process. So let's get started.
In our case, listing the functional requirements for the example application will be a good starting point for our data model design. Here's the list of our requirements:
- Provide product team the ability to maintain category and product details.
- Provide customer service representatives the ability to take orders and track order status.
- Provide the functionality to generate purchase receipts that can be saved to a customers account.
A simple way to identify the entities and activities/process is to perform noun-verb analysis on the requirements. The nouns translate into entities, while the verbs translate into activities. Since our aim is to create the data model, we will focus on the entities and leave the activities/process analysis for later.
Identify the data entities
- Category details
- Product details
- Customer details
- Customer orders
- User details
Identify the attributes of the entities
- Category code
- Category description
- Product code
- Product description
- Product price
- Product colour (>1)
- Product size (>1)
- Product image (>1)
- First name
- Last name
- Full name
- Mail ID
- Date of Birth
- Billing address (>1)
- Order ID
- Order amount
- Order status
- Order date
- Order fulfillment date
- Product orders (>1)
- User login ID
- User group/function
Organize the data
The process of organizing the data is called as normalization. Data is normalized for two main reasons:
- Remove redundant data
- Organize data efficiently by storing only related data together
How do we organize our data for the example application?
- Product details, customer details and customer orders can be normalized.
- A product may be available in multiple colours; each coloured tees may be available in one or more sizes -- Small (S), Medium (M), Large (L) etc. Product details can be split into product master, product colour and product size.
- A customer can have multiple addresses -- billing address, delivery address etc. Customer details can be split into customer master, customer address.
- When placing an order, a customer can order multiple products. Customer orders can be split into customer orders (to store order summary) and product orders (to store product order details).
Identify the relationship between entities
- A product must belong to one of the categories.
- Orders can be placed for only for the products available in the catalog.
- Feedback can be given only for the orders placed by the customer.
Represent the data model pictorially
TRY IT YOURSELF!
Make the necessary changes in the data model to incorporate the functionality to record customer feedback for each customer order.