zaro

How are data models made?

Published in Data Modeling 3 mins read

Data models are made by translating business requirements and rules into a concrete database design, using various levels of abstraction.

Here's a breakdown of the process:

1. Gathering Requirements

  • Stakeholder Interviews: The process begins by collecting information directly from stakeholders and end-users. This involves understanding their needs, expectations, and the business processes they perform.
  • Business Rules Extraction: Identify and document the rules governing the data. These rules define relationships, constraints, and calculations within the organization. Examples include:
    • A customer can have multiple orders.
    • An order must have at least one product.
    • Discounts are applied based on order total.

2. Conceptual Data Modeling

  • High-Level Overview: This phase involves creating a high-level, abstract representation of the data. It focuses on identifying the key entities, attributes, and relationships within the system.
  • Entity-Relationship Diagrams (ERDs): ERDs are often used to visually represent the conceptual data model. They depict entities (like customers, products, orders), attributes (like customer name, product price, order date), and relationships between them (like "a customer places an order").

3. Logical Data Modeling

  • Refinement and Detail: The logical data model expands on the conceptual model by adding more detail. This includes specifying data types (e.g., integer, string, date), primary keys, and foreign keys.
  • Normalization: Apply normalization techniques to reduce data redundancy and improve data integrity. This involves organizing data into tables in a way that minimizes duplication and dependencies. Common normalization forms include 1NF, 2NF, and 3NF.
  • Data Relationships: Define the specific relationships between tables, such as one-to-one, one-to-many, and many-to-many.

4. Physical Data Modeling

  • Implementation Specifics: The physical data model defines how the data will be physically stored in a specific database management system (DBMS), such as MySQL, PostgreSQL, or Oracle.
  • Table Structures: This includes specifying table names, column names, data types, indexes, and constraints.
  • Storage Considerations: Consider factors like storage space, performance requirements, and security.
  • Database-Specific Features: Utilize features specific to the chosen DBMS, such as partitioning, indexing, and stored procedures.

5. Validation and Refinement

  • Testing and Review: The data model is tested and reviewed by stakeholders and database administrators to ensure it meets the business requirements and performance goals.
  • Iteration: Based on the feedback, the data model is refined and adjusted as necessary. This iterative process continues until the model is deemed satisfactory.

Example Scenario

Let's say a company wants to create a database for managing their products and customers.

  1. Requirement: "We need to track customer information, product details, and orders."
  2. Conceptual: Entities might include Customer, Product, and Order. Relationships: Customer places Order, Order includes Product.
  3. Logical:
    • Customer table: CustomerID (INT, Primary Key), CustomerName (VARCHAR), CustomerAddress (VARCHAR)
    • Product table: ProductID (INT, Primary Key), ProductName (VARCHAR), ProductPrice (DECIMAL)
    • Order table: OrderID (INT, Primary Key), CustomerID (INT, Foreign Key referencing Customer.CustomerID), OrderDate (DATE)
    • OrderDetails table: OrderID (INT, Foreign Key referencing Order.OrderID), ProductID (INT, Foreign Key referencing Product.ProductID), Quantity (INT)
  4. Physical: Specific table creation statements for MySQL, including index definitions, character sets, and storage engines.

In summary, data models are made by systematically translating business requirements into a structured representation of data, starting with high-level concepts and progressively refining the model for physical implementation within a database system.