Unit - 1 Data Models
Unit - 1 Data Models
Unit -1
Main Topic: Data Models
• The Importance of Data Models.
• Basic building blocks
• Business rules
• The evolution of data models
• Degrees of data abstraction.
Data Models: Introduction
• A collection of tools for describing:
• Data
• Data Relationships
• Data Semantics
• Data consistency constraints
• A data model provides a way to describe the design of a database at the
physical, logical, and view levels.
• Data Model-Relatively simple representations of complex real world data
structures
• Creating a Data model is iterative and progressive
• Designers, programmers, and end users see data in different ways
The Importance of Data Model
• Facilitate interaction among the designer, the applications
programmer, and the end user.
• End users have different views and needs for data- Data model
organizes data for various users.
• Data model is a conceptual model - an abstraction
• It’s a graphical collection of logical constructs representing the data
structure and relationships within the database.
Data Model - Basic Building Blocks
• Entity - anything about which data are to be collected and stored
• Attribute - a characteristic of an entity
• Relationship - describes an association among entities
• One-to-many (1:M) relationship
• Many-to-many (M:N or M:M) relationship
• One-to-one (1:1) relationship
• Constraint - a restriction placed on the data
Business Rules
• Brief, precise, and unambiguous descriptions of a policies,
procedures, or principles within a specific organization.
• Apply to any organization that stores and use data to
generate information.
• Description of operations or procedures, to create/enforce
actions within an organization’s environment
• Must be in writing and kept up to date
• Must be easy to understand and widely disseminated
• Sometimes externally defined, i.e. government regulations.
Discovering Business Rules
• Sources of business rules:
• Company managers
• Policy makers
• Department managers
• Written documentation
• Procedures
• Standards
• Operations manuals
• Direct interviews with end users
Importance of Business Rules
• Standardize company’s view of data
• Useful as a communications tool between users and designers
• Allows the designer to
• understand the nature, role, and scope of data
• understand business processes
• develop appropriate relationship participation rules and constraints
• Promotes the creation of an accurate data model
Translating Business Rules into Data Model
Components
• Generally, nouns translate into entities
• Verbs translate into relationships among entities
• Relationships are bidirectional
• Two questions to identify the relationship type:
• How many instances of B are related to one instance of A?
• How many instances of A are related to one instance of B?
Examples: Business Rules
• Some examples of business rules:
Departments ------offers---------Course
Course----------generates---------Class
Professor ->->->->->teaches->->->->->Class
Evolution of Data Implementation Models
• Hierarchical
• Logically represented by an upside down tree
• Each parent can have many children
• Each child has only one parent
• Network
• Relational
• Object oriented
• Hybrid, XML
Evolution of Data Implementation Models
The Hierarchical Model
• Developed in the 1960s to manage large amounts of data for complex
manufacturing projects
• Basic logical structure is represented by an upside down “tree”
• Hierarchical structure contains levels or segments
• Depicts a set of one-to-many relationships between segments
• Each parent can have many children
• Each child has only one parent
• For eg, most file systems work this way.
• There is usually a root, or top-level, directory that contains various other directories and
files. Each file or directory can only exist in one directory itself
Example: The Hierarchical Model
Disadvantage: The Hierarchical Model
• It represents one-to-many relationships well i.e one parent has many
children;
• for example, one company branch has many employees
• It has problems with many-to-many relationships.
• Relationships such as that between a product file and an orders file are
difficult to implement in a hierarchical model. Specifically, an order can
contain many products, and a product can appear in many orders.
• Hierarchal model is not flexible because adding new relationships can
result in wholesale changes to the existing structure, which in turn
means all existing applications need to change as well. M
The Network Model
• The network model was created to represent complex data
relationships more effectively than the hierarchical model.
• Improves database performance
• Imposes a database standard
• Represent complex data relationships more effectively -such as child with
multiple parents
• Relationship in the network database model is defined as many-to-
many relationship because one owner file can be linked to many
member files and vice versa.
The Network Model
Network Database vs. Hierarchical Database Model
Easily accessed because of the linkage Difficult to navigate because of its strict owner
between the information to member connection
Great flexibility among the information files Less flexibility with the collection of
because the multiple relationships among the information because of the hierarchical
files position of the files
Network Database Model
• Domain constraints:
• Domain constraints can be violated if an attribute value is not appearing in
the corresponding domain or it is not of the appropriate data type.
• This is specified as data types which include standard data types integers, real
numbers, characters, Booleans, variable length strings, etc.
• Key constraints:
• An attribute that can uniquely identify a tuple in a relation is called the key of
the table. The value of the attribute for different tuples in the relation has to
be unique.
• Referential integrity constraints
Object-Based Data Model
• Object-oriented programming (especially in Java,C++, or C#) has
become the dominant software-development methodology.
• This led to the development of an object-oriented data model that
stores data in the form of objects and classes.
• An object is an real world entity
• A class is a collection of objects
• Can be seen as extending the E-R model with notions of
encapsulation, methods (functions), and object identity.
• Object Oriented Programming + Relational Database Features
= Object Oriented Database Model