Design a Simple ERP System Data Model

Data Structures
Medium
Salesforce
95.3K views

Describe the core relational tables and foreign key relationships needed to model a basic Enterprise Resource Planning (ERP) system (e.g., inventory, orders, customers).

Why Interviewers Ask This

Interviewers at Salesforce ask this to evaluate your ability to translate complex business logic into normalized, scalable relational schemas. They specifically assess if you can identify core entities like Customers, Orders, and Inventory, and define precise one-to-many relationships. This tests your understanding of data integrity constraints and how a unified system manages interconnected workflows critical to CRM and ERP environments.

How to Answer This Question

1. Clarify Scope: Briefly confirm the specific modules (e.g., Sales vs. Supply Chain) to ensure alignment with the interviewer's expectations. 2. Identify Core Entities: List the essential tables first, such as 'Customers', 'Products', 'Orders', and 'OrderItems'. 3. Define Relationships: Explicitly map foreign keys, explaining why an Order belongs to a Customer and how OrderItems links them via composite keys. 4. Discuss Normalization: Mention achieving Third Normal Form (3NF) to reduce redundancy, specifically separating product details from order transactions. 5. Address Scalability: Briefly touch on indexing strategies for high-volume queries or partitioning for large datasets, reflecting Salesforce's enterprise scale requirements.

Key Points to Cover

  • Explicitly defining the junction table (OrderItems) to resolve many-to-many relationships
  • Demonstrating normalization principles to prevent data redundancy and update anomalies
  • Connecting business logic (sales process) directly to technical schema choices
  • Considering performance implications like indexing for high-volume enterprise data
  • Including audit fields to support traceability and compliance requirements

Sample Answer

To design a basic ERP data model, I would start by identifying the five core entities required for transactional integrity: Customers, Products, Suppliers, Orders, and OrderItems. First, I'd create a 'Customers' table with a primary key 'customer_id' to store contact details. Next, a 'Products' table would hold SKU, description, and unit price, linked to a 'Suppliers' table via a foreign key to manage sourcing. The central entity is 'Orders', which contains order metadata like date and status, linking back to 'Customers' through a 'customer_id' foreign key. Crucially, I would introduce a junction table called 'OrderItems' to handle the many-to-many relationship between Orders and Products. This table would contain composite foreign keys referencing both 'order_id' and 'product_id', along with quantity and line-item pricing to capture historical snapshot data. This structure ensures Third Normal Form by avoiding data duplication in product descriptions within orders. For performance, I would recommend indexing 'customer_id' and 'order_date' columns to optimize lookup speeds, a practice vital for systems handling Salesforce-level transaction volumes. Finally, adding audit columns like 'created_at' and 'updated_at' would support change tracking essential for enterprise compliance.

Common Mistakes to Avoid

  • Creating denormalized tables that duplicate product prices inside the Order table, causing data inconsistency
  • Failing to define a separate junction table for items, leading to ambiguous relationships between orders and products
  • Ignoring referential integrity constraints, which could allow orphaned records in a production environment
  • Overlooking non-functional requirements like indexing or audit trails needed for large-scale systems

Practice This Question with AI

Answer this question orally or via text and get instant AI-powered feedback on your response quality, structure, and delivery.

Start Practicing

Related Interview Questions

Browse all 154 Data Structures questionsBrowse all 49 Salesforce questions