Chapter 2 Data Models Database Systems: Design, Implementation, and Management, Rob and Coronel Adapted for INFS-3200
Data Models Models are simplified abstractions of real world events or conditions (general). A data model is the relatively simple representation, usually graphic, of complex real-world data structures. It represents data structures and their characteristics, relations, constraints, and transformations. A database model is a collection of logical constructs used to represent the data structure and the data relationships found within the database. A model illustrates what data is being represented (of interest for the end user or system) and how the data elements relate to each other Logical i m p l e m e n t a t i o n physical
Data Models Building Blocks Entities: objects of interest for end user. Each entity describes a particular and different type of object in the real world. Attributes: characteristics that describe a particular type of object. Relationships: association among entities One-to-many relationships (1:M) A painter paints many different paintings, but each one of them is painted by only that painter. PAINTER (1) paints PAINTING (M) Many-to-many relationships (M:N) An employee might learn many job skills, and each job skill might be learned by many employees. EMPLOYEE (M) learns SKILL (N) One-to-one relationships (1:1) Each store is managed by a single employee and each store manager (employee) only manages a single store. EMPLOYEE (1) manages STORE (1) Relationships have direction (determining the roles of entities) Constraint A restriction placed on the data. Salary must be greater than 0 and less than 350,0000 A GPA must be greater than o and less or equal to 4.00 with two decimals Entities, attributes and relationships derive from "business rules"...
Business Rules A business rule is a brief, precise and unambiguous description of a policy, procedure, or principle within an specific organization. Business rules: apply to all types of organizations. derive from a detail description of an organization’s operations. should be stated in writing should be easy to understand should be widely disseminated should be updated frequently
Business Rules Business rules originate from many sources: Manages, policy makers, department managers, written documentation, external sources, operation manuals, etc. Business rules are essential to: Set standards within an organization Communication tool among users and designers Describe the nature, role and scope of data Understanding of business processes Developing a data model
Business Rules Business rules are used to define: entities, attributes, relationships, constrains, processes. A customer may generate many invoices. An invoice belongs to only one customer. A customer may make many payments on account. Each payment on account is credited to only one customer. A machine operator may not work more than 10 hours in any 24-hour period. A training session cannot be scheduled for fewer than 10 employees or more than 30 employees. An student can take many classes A class can be taken by many students A class is a section of a course A course can have many classes and a class belongs to one course An employee is the manager of many employees and each employee can have only one manager A department employs many professors and each professor is employed by (work for) only one department A professor chairs a department and each department is chaired by only one professor
Transforming Business Rules into a Data Model Business rules identify entities, attributes and relationships. Nouns-> entities* Verbs -> relationships* Modifiers of nouns* -> attributes, constraints, other entities or relations. Modifiers of verbs* -> relationship’s roles, constraints or new relations Relationship identification, always ask: Can one instance of A be related to ? 1 (or M) instace(s) of B? Can one instance of B be related to ? 1 (or M) instace(s) of A? One student can take many classes One class can be taken by many students One employee can have many dependents One dependent is related to only one employee * Extended Relational Analysis from Relational Systems Corp.
Entity-Relationship Diagrams It is one of the most widely accepted conceptual data modeling tools. It graphically represents data as entities and their relationships in a database structure. It complements the relational data model concepts. Basic Structure E-R models are normally represented in an entity relationship diagram (ERD). An entity is represented by a rectangle. Each entity is described by a set of attributes. An attribute describes a particular characteristics of the entity. A relationship is represented by a diamond connected to the related entities.
ER MODEL NOTATIONS The end