DTB01 les1

Embed Size (px)

Citation preview

  • 8/8/2019 DTB01 les1

    1/39

    Gegevens analyse

    Les 1

    Fedor Wagenaar

  • 8/8/2019 DTB01 les1

    2/39

    Data in Tables

  • 8/8/2019 DTB01 les1

    3/39

    The Key Characteristic of

    Databases: Related Tables

  • 8/8/2019 DTB01 les1

    4/39

    Database Examples

  • 8/8/2019 DTB01 les1

    5/39

    MS Access in Detail

  • 8/8/2019 DTB01 les1

    6/39

    Enterprise-Class Database

    Systems

  • 8/8/2019 DTB01 les1

    7/39

    The Database

    A database is a self-describing collectionof integrated tables

    The tables are called integrated becausethey store data about the relationshipsbetween the rows of data

    A database is called self-describing

    because it stores a description of itself The self-describing data are called

    metadata, which is data about data

  • 8/8/2019 DTB01 les1

    8/39

    Typical Metadata Tables

  • 8/8/2019 DTB01 les1

    9/39

    Database Contents

  • 8/8/2019 DTB01 les1

    10/39

    Three Types ofDatabase Design

  • 8/8/2019 DTB01 les1

    11/39

    Database Design from Existing Data

  • 8/8/2019 DTB01 les1

    12/39

    Data Import: One or Two Tables?

    This is an important

    decision, and based

    on a set of rules

    known as

    normalization (whichis covered in Chapter

    Three)

  • 8/8/2019 DTB01 les1

    13/39

    Database Design from New

    Systems

    Development

    Entity-Relationship data modeling is covered in Chapter Five, and data model

    transformations to database designs are covered in ChapterSix

  • 8/8/2019 DTB01 les1

    14/39

    Database Design from Database

    Redesign

    Database redesign is

    covered in Chapter

    Eight, after coverage of

    SQL in ChapterSeven

  • 8/8/2019 DTB01 les1

    15/39

    Knowledge Priorities

  • 8/8/2019 DTB01 les1

    16/39

    The Data Model

    A data model is a plan, or blueprint, for a

    database design.

    A data model is more generalized andabstract than a database design.

    It is easier to change a data model than it

    is to change a database design, so it is the

    appropriate place to work through

    conceptual database problems.

  • 8/8/2019 DTB01 les1

    17/39

    Entities

    Something that can be identified and theusers want to track

    Entity class a collection of entities of a

    given type Entity instance the occurence of a

    particular entity

    There are usually many instances of anentity in an entity class.

  • 8/8/2019 DTB01 les1

    18/39

    CUSTOMER:The Entity Class and Two Entity Instances

  • 8/8/2019 DTB01 les1

    19/39

    Attributes

    Attributes describe an entityscharacteristics.

    All entity instances of a given entity classhave the same attributes, but vary in thevalues of those attributes.

    Originally shown in data models as

    ellipses. Data modeling products today commonly

    show attributes in rectangular form.

  • 8/8/2019 DTB01 les1

    20/39

    EMPLOYEE:

    Attributes in Ellipses

  • 8/8/2019 DTB01 les1

    21/39

    EMPLOYEE:

    Attributes in Entity Rectangle

  • 8/8/2019 DTB01 les1

    22/39

    Identifiers

    Identifiers are attributes that name, or identify, entity

    instances.

    The identifier of an entity instance consists of one or

    more of the entitys attributes. Composite identifiers: Identifiers that consist of two or

    more attributes

    Identifiers in data models become keys in database

    designs:

    Entities have identifiers.

    Tables (or relations) have keys.

  • 8/8/2019 DTB01 les1

    23/39

    Entity Attribute Display

    in Data Models

  • 8/8/2019 DTB01 les1

    24/39

    Relationships

    Entities can be associated with one another in

    relationships: Relationship classes: associations among entity classes

    Relationship instances: associations among entity instances

    In the original E-R model, relationships could

    have attributes but today this is no longer done.

    A relationship class can involve two or more

    entity classes.

  • 8/8/2019 DTB01 les1

    25/39

    Degree of the Relationship

    The degree of the relationship is the number of

    entity classes in the relationship:

    Two entities have a binary relationship of degree

    two. Three entities have a ternary relationship of degree

    three.

  • 8/8/2019 DTB01 les1

    26/39

    Binary Relationship

  • 8/8/2019 DTB01 les1

    27/39

    Ternary Relationship

  • 8/8/2019 DTB01 les1

    28/39

    Entities and Tables

    The principle difference between an entity

    and a table (relation) is that you can

    express a relationship between entities

    without using foreign keys.

    This makes it easier to work with entities in

    the early design process where the very

    existence of entities and the relationshipsbetween them is uncertain.

  • 8/8/2019 DTB01 les1

    29/39

    Cardinality

    Cardinality means count, and is

    expressed as a number.

    Maximum cardinality is the maximumnumber of entity instances that can

    participate in a relationship.

    Minimum cardinality is the minimum

    number of entity instances that must

    participate in a relationship.

  • 8/8/2019 DTB01 les1

    30/39

    Maximum Cardinality

    Maximum cardinality is the maximum

    number of entity instances that can

    participate in a relationship.

    There are three types of maximum

    cardinality:

    One-to-One [1:1]

    One-to-Many [1:N]

    Many-to-Many [N:M]

  • 8/8/2019 DTB01 les1

    31/39

    The Three Types of

    Maximum Cardinality

  • 8/8/2019 DTB01 les1

    32/39

    Parent and Child Entities

    In a one-to-many relationship: The entity on the one side of the relationship is called

    the parent entity or just the parent.

    The entity on the many side of the relationship iscalled the child entity or just the child.

    In the figure below, EMPLOYEE is the parentand COMPUTER is the child:

  • 8/8/2019 DTB01 les1

    33/39

    Minimum Cardinality

    Minimum cardinality is the minimum number ofentity instances that must participate in arelationship.

    Minimums are generally stated as either zero orone: IF zero [0] THEN participation in the relationship by

    the entity is optional, and no entity instance mustparticipate in the relationship.

    IF one [1] THEN participation in the relationship bythe entity is mandatory, and at least one entityinstance must participate in the relationship.

  • 8/8/2019 DTB01 les1

    34/39

    Indicating Minimum Cardinality

    As shown in the examples in a following

    slide:

    Minimum cardinality of zero [0] indicating

    optional participation is indicated by placing

    an oval next to the optional entity.

    Minimum cardinality of one [1] indicating

    mandatory (required) participation isindicated by placing a vertical hash mark

    next to the required entity.

  • 8/8/2019 DTB01 les1

    35/39

    Reading Minimum Cardinality

    Look toward the entity in question:

    IF you see an oval THEN that entity is

    optional (minimum cardinality of zero [0]).

    IF you see a vertical hash mark THEN that

    entity is mandatory (required) (minimum

    cardinality of one [1]).

  • 8/8/2019 DTB01 les1

    36/39

    The Three Types of

    Minimum Cardinality

  • 8/8/2019 DTB01 les1

    37/39

    Data Modeling Notation

  • 8/8/2019 DTB01 les1

    38/39

    Data Modeling Notation:

    ERwin

  • 8/8/2019 DTB01 les1

    39/39

    Data Modeling Notation:

    N:M and O-MNote that:

    (1) ERwin cannotindicate trueminimum

    cardinalities onN:M relationships

    (2) Visio introducesthe intersectiontable instead of

    using a true N:Mmodel