Top Banner

of 33

Lecture 1b - Database Models

Apr 08, 2018

Download

Documents

dpriya84
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 8/6/2019 Lecture 1b - Database Models

    1/33

    Lecture 1bData Models

    Reference Textbook: An Introduction to Database

    Systems

    Eighth Edition

    C.J.Date

  • 8/6/2019 Lecture 1b - Database Models

    2/33

    2

    Lecture 1b Overview

    Definitions

    Evolution of Data Models

  • 8/6/2019 Lecture 1b - Database Models

    3/33

    3

    Data Models

    Data modelis an abstract model that describes how data isrepresented and used

    ORData modelis a collection of logical constructs used to represent the

    data structure and the data relationships found within the database.

    Two Categories of Database Models:

    Logical or Conceptual models focus on the logical nature of the

    data representation. They are concerned with whatisrepresented rather than howit is represented.

    Physical or Implementation models place the emphasis onhowthe data are represented in the database or on howthe datastructures are implemented.

  • 8/6/2019 Lecture 1b - Database Models

    4/33

    4

    Data Models

    Numerous logical data models have been proposed,under two main groups:

    - Object-based models

    entity-relationship, object-oriented, semantic,functional, ...

    - Record based models

    relational, network, hierarchical, ...

  • 8/6/2019 Lecture 1b - Database Models

    5/33

    5

    The Evolution of Data Models

  • 8/6/2019 Lecture 1b - Database Models

    6/33

    6

    The Hierarchical ModelEvolution

    Developed in the 1960s to manage large

    amounts of data for manufacturing projects

    Information Management System (IMS)

    Worlds leading mainframe hierarchical database

    system in the 1970s and early 1980s

  • 8/6/2019 Lecture 1b - Database Models

    7/33

    7

    Hierarchical Structure-Characteristics

    Logically represented by an upside down tree

    Each parentcan have many children Each childhas only one parent

    Tree is defined by path that traces parent segments to

    child segments, beginning from the left

    Hierarchical path Ordered sequencing of segments tracing hierarchical structure

    Preorder traversal or hierarchic sequence Left-list path

  • 8/6/2019 Lecture 1b - Database Models

    8/33

  • 8/6/2019 Lecture 1b - Database Models

    9/33

    9

    Customer ata

    Name ddress Phone Pointer toChecking

    cct. ata

    Pointer to uto

    Loan ata

    Maria Chavez 1441 damsCourt 605-777-8992John everson 8988 Grover oad 605-898-2314Harold Brown 3511 Pluto rive 605-666-3298

    Checking ccount ata

    cct. Number Current Balance ate LastTransaction

    986-335 445.11 07/11/03

    988-310 2988.44 07/01/03355-822 898.14 06/15/03

    uto Loan ata

    cct. Number Current Balance ate Last Pmt

    100988 5676 06/15/03

    101732 1545.33 07/01/03

    Hierarchical DatabasesHierarchical Databases

  • 8/6/2019 Lecture 1b - Database Models

    10/33

    10

    Hierarchical Model

    Foundation for current data models

    Advantages Conceptual simplicity

    Database security and integrity

    Data independence

    Efficiency

    Disadvantages Complex implementation

    Difficult to manage

    Lack of standards

    Lacks structural independence

    Relationships do not conform to 1:M form

    No standards for how to implement

  • 8/6/2019 Lecture 1b - Database Models

    11/33

    11

    Child with Multiple Parents

  • 8/6/2019 Lecture 1b - Database Models

    12/33

    12

    Network Model

    Created to represent complex data relationships more effectively

    Improve database performance

    Impose a database standard

    Resembles hierarchical model

    Record may have more than one parent

    Collection of records in 1:M relationships

    Each record can have multiple parents

    Composed of sets

    Each set has owner record and member record

    Member may have several owners

  • 8/6/2019 Lecture 1b - Database Models

    13/33

    13

    ANetwork Data Model

  • 8/6/2019 Lecture 1b - Database Models

    14/33

    14

    Network Data Model

    Advantages Conceptual simplicity

    H

    andles more relationship types Data access flexibility

    Promotes database integrity

    Data independence

    Conformance to standards

    Disadvantages System complexity Lack of ad hoc query capability placed burden on programmers to

    generate code for reports

    Structural change in the database could produce havoc in allapplication programs

  • 8/6/2019 Lecture 1b - Database Models

    15/33

    15

    Relational Model

    Developed byCodd (IBM) in 1970

    Considered ingenious but impractical in 197

    0 Conceptually simple

    Computers lacked power to implement the relational model

    Today, microcomputers can run sophisticated relational

    database software

  • 8/6/2019 Lecture 1b - Database Models

    16/33

    16

    Relational database is perceived as collection of tables.

    Each table consists of series of row/column intersections.

    Tables (or relations) are related to each other by sharing acommon entity characteristic.

    Relationship type is often shown in a relational schema.

    Table yields complete data and structural independence.

    Relational Data Models Basic StructureRelational Data Models Basic Structure

  • 8/6/2019 Lecture 1b - Database Models

    17/33

    17

    Linking Relational Tables

  • 8/6/2019 Lecture 1b - Database Models

    18/33

    18

    ARelational Schema

  • 8/6/2019 Lecture 1b - Database Models

    19/33

    19

    SQL-based relational database application involves three parts:

    User interface Allows end user to interact with data

    Set of tables stored in database Each table is independent from another

    Row

    s in different tables related based on common valuesin common attributes

    SQL engine Executes all queries

    Relational Model (continued)

  • 8/6/2019 Lecture 1b - Database Models

    20/33

    20

    Advantages

    Structural independence

    Improved conceptual simplicity

    Easier database design, implementation, management, and use

    Ad hoc query capability (SQL)

    Powerful database management system

    Disadvantages

    Substantial hardware and system software overhead

    Possibility of poor design and implementation

    Potential islands of information problems

    Relational ModelRelational Model

  • 8/6/2019 Lecture 1b - Database Models

    21/33

    21

    Entity-Relationship Data Model

    Introduced by Chen in 1976

    One of the most widely accepted graphical data

    modeling tools.

    Graphically represents data as entities and theirrelationships in database structure.

    Complements the relational data model concepts.

  • 8/6/2019 Lecture 1b - Database Models

    22/33

    22

    EntityRelationship Model - Basic Structure

    Entity-Relationship model represented as entity/relationship(E/R)

    diagram (see fig. 1.6, page 12)

    An entity is represented by a rectangle:

    - Entity is an object represented in a database (for example1.6,

    Employees, rojects, Departments and so on are various objects)

    - Each entity is described by a set ofproperties ( ropertiesdescribes particular characteristics of the entity)

    - Relationship is represented by a diamond connected to the

    related entities.

  • 8/6/2019 Lecture 1b - Database Models

    23/33

    23

    Entity and Relationships

    Types of Relationships: One-to-many relationships (1:M)

    A painter paints many different paintings, but each one ofthem 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 skillmight 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 storemanager (employee) only manages a single store.

    EMPLOYEE (1) manages STORE (1)

  • 8/6/2019 Lecture 1b - Database Models

    24/33

    24

    Relationship Depiction: The ERD

  • 8/6/2019 Lecture 1b - Database Models

    25/33

    25

    Relationship Depiction: The Crows Foot

  • 8/6/2019 Lecture 1b - Database Models

    26/33

    26

    Advantages

    Exceptional conceptual simplicity

    Visual representation

    Effective communication tool

    Integrated with relational database model

    Disadvantages

    Limited constraint representation

    Limited relationship representation

    No data manipulation language

    E-R Data ModelsE-R Data Models

  • 8/6/2019 Lecture 1b - Database Models

    27/33

    27

    Object-Oriented (OO) Model

    Semantic data model (SDM) developed by Hammer

    and McLeod in 1981

    Data and their relationships contained in a single

    structure known as an object

    Basis of object oriented data model (OODM)

    OODM becomes the basis for the object oriented

    database management system (OODBMS)

  • 8/6/2019 Lecture 1b - Database Models

    28/33

    28

    Object Oriented Data Model - Basic StructureOODM

    Objects or abstractions of real-world entities arestored: Attributes describe properties

    Collection of similar objects is a class

    Methods represent real world actions of classes

    Classes are organized in a class hierarchy

    Inheritance is ability of object to inherit attributes and

    methods of classes above it UML based on OO concepts that describe

    diagrams and symbols Used to graphically model a system

  • 8/6/2019 Lecture 1b - Database Models

    29/33

    29

  • 8/6/2019 Lecture 1b - Database Models

    30/33

  • 8/6/2019 Lecture 1b - Database Models

    31/33

    31

    The Development of Data Models

  • 8/6/2019 Lecture 1b - Database Models

    32/33

    32

    Data Models: Summary

    Data Models and theirTasks:

    Conceptual models (E-R Model): better suited for high-level data modeling

    Implementation models (Network, & HierarchicalModels): better for managing stored data forimplementation purposes

    Relational, & OODM: can be used as both conceptual &implementation models

  • 8/6/2019 Lecture 1b - Database Models

    33/33

    33