lesson 2 database

Upload: reza1366

Post on 05-Apr-2018

224 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/31/2019 Lesson 2 Database

    1/22

    DATABASE

    MBADavid Asirvatham

  • 7/31/2019 Lesson 2 Database

    2/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Database Model

    There four database models: Relational Database Model

    Object-Oriented Database Model

    Hierarchical Database Model

    Network Database Model

    the Hierarchical and Network database models arethe oldest and least used

  • 7/31/2019 Lesson 2 Database

    3/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Relational Database

    Most widely used database

    it uses a series of two dimensional tables or files

    e.g. Partsfile &Customerfile (in earlier example)

    each table stores data pertaining to a particular

    entity class

    An entity class is a concept of things (or people orplaces) that are stored in the database

    example of entity class are parts, customers orstudents

    an instance (record) is an occurrence of an entityclass

  • 7/31/2019 Lesson 2 Database

    4/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Relational Database

    It is built on a simple concept of representing datain a two-dimensional tables

    easy to identify the entity class

  • 7/31/2019 Lesson 2 Database

    5/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Object-oriented Database

    might be tomorrows database (future)

    it is based on objects

    an entity class in object-oriented database is similar

    to the entity class in a relational database

    in object-oriented, the object includes orencapsulates both information about a specificentity class and the software instruction

    (procedures) to work on the information.

  • 7/31/2019 Lesson 2 Database

    6/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Object-oriented database

    CustomerInformation:

    Customer ID

    Name

    Phone

    Address

    Procedures:

    Add new customer

    Get Customer Information

    Change Address

    Save Customer information

    PartsInformation:

    Part #

    Description

    Quantity

    Price

    Procedures:

    Add new part

    Get part Information

    Update quantity

    Save Part information

    Object representation

  • 7/31/2019 Lesson 2 Database

    7/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    OODB

    OODB allows you to work with bothdata/information and procedures

    object-oriented database management (OOBDMS) isa DBMS software that allows you to develop and

    work with OODB

    advantages of OODB combines data and procedures thus closer to the way organisations work

    reusable (e.g. a Video Rental object may contain Customer object)

  • 7/31/2019 Lesson 2 Database

    8/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    OODB

    CustomerInformation:

    Customer ID

    Name

    Phone

    Address

    Procedures:

    Add new customer

    Get Customer Information

    Change Address

    Save Customer information

    Video RentalInformation:

    CUSTOMER

    VIDEO

    Date Rented

    Date Returned

    Procedures:

    Create new Video Rental

    Calculate total Price

    Get Video Rental Info

    Save Video Rental

    Related

    Objects

  • 7/31/2019 Lesson 2 Database

    9/22

  • 7/31/2019 Lesson 2 Database

    10/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 1: Defining Entity Classes

    Identity the entity classes e.g. Employee, Department and Job

    Identity the primary key e.g. for Employee it is Emp ID

    for Department it could be Dept. Code

  • 7/31/2019 Lesson 2 Database

    11/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 2: Defining Relationships

    Entity-Relationship (ER) diagram may be used

    There are 7 symbols used in ER: a rectangle to denote an entity class

    a diamond to denote a relationship between two entity classes

    a line to connect symbols

    a 1 to denote a single occurrence

    a M to denote multiple occurrence

    An o to denote an optional relationship

  • 7/31/2019 Lesson 2 Database

    12/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 2: Defining Relationship

    How to read?

    Follow arrow A and B

    A :An Employee is assigned to one and must be assigned to one department.

    B:A Department may have many employees assigned or may not have

    any employee assigned to it.

    EMPLOYEE DEPARTMENTM:1

    A

    B

  • 7/31/2019 Lesson 2 Database

    13/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 2: Defining Relationship

    EMPLOYEE DEPARTMENTM:1

    JOBM:M

  • 7/31/2019 Lesson 2 Database

    14/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 2: Defining Relationship(Normalisation)

    After drawing the ER diagram, you will need tonormalise it

    Normalisation is a process of assuring that arelational database structure can be implemented as

    a series of tables

    There are 3 basic rules for normalisation eliminate repeating groups (i.e. M:M relationships)

    assure that each field in a relation depends only on the primary key of

    that relation

    remove all derived fields from the relations

  • 7/31/2019 Lesson 2 Database

    15/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 2: (Normalisation)

    JOBM:MEMPLOYEE

    JOBM:1EMPLOYEE-JOBEMPLOYEE 1:M

    Primary Key

    Emp ID

    1345

    3758

    3899

    4571

    Primary Key

    Emp ID

    13453758

    3899

    4571

    Primary Key

    Job Code

    17

    22

    2532

    Primary Key

    Job Code

    1722

    25

    32

    Primary Key

    Emp ID + Job Code

    1345 + 171345 + 25

    3758 + 17

    3899 + 25

    3899 + 32

    4571 + 22

    4571 + 25

  • 7/31/2019 Lesson 2 Database

    16/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 3: Defining fields for each Relation

    To determine the data that will be in a relation, wemust ask Does this data depend only on theprimary key for this relation?

    If yes, then it is in the right relation

    Example: Employee (Emp ID, Name, Dept., Dept. Location)

    Job (Job Code, Job Name)

    Department (Dept., Dept. Location, Number of Employees)

    Employee-Job (Emp ID, Job Code, Hours)

  • 7/31/2019 Lesson 2 Database

    17/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Step 4: Use DDL to create the database

    Use the DDL to create the relations

    define the data dictionary

    set the primary key and properties of each field

  • 7/31/2019 Lesson 2 Database

    18/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Data Warehouse

    A data warehouse is a logical collection ofinformation- gathered from many differentoperational databases - that supports businessanalysis activities and decision-making tasks

    it combines information from different databases

    gather only the required information for decision-making

    require information is defined by the user

  • 7/31/2019 Lesson 2 Database

    19/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Data Warehouse

    most data warehouses are multidimensionaldatabases - they contain layers of columns and rows(this is called hybercube)

    Product

    3

    Penang

    Ipoh

    KL

    Melaka

    JB

    Product

    1

    Product

    2

    Product

    4

    Product

    5

    Year

    Credit

    What percentage of the total sales for

    product 3 in Ipoh were credit sales?

  • 7/31/2019 Lesson 2 Database

    20/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Data warehouse

    Data warehouse also has a data dictionary

    the data dictionary maintains: logical structure of the information

    origin (source database)

    methods (e.g. total, count, average, std deviation, etc)

    Data warehouse supports online analyticalprocessing most database support online transaction processing

  • 7/31/2019 Lesson 2 Database

    21/22

    TITLE

    CONTENT

    msuUniversity of ChoiceDavid Asirvatham

    Database Systems

    Data Mining Tools

    Data mining tools are software tools used to query

    information in a data warehouse

    it supports online analytical processing

    Data mining includes:

    Query-and-Reporting Tools

    Intelligent Agents

    Multidimensional Analysis Tools

    DATA

    WAREHOUSE

    DATA

    WAREHOUSE

    ENGINE

    Query-and-Reporting Tools

    Intelligent Agents

    Multidimensional Analysis Tools

  • 7/31/2019 Lesson 2 Database

    22/22

    TITLE

    CONTENT

    msuU f hDavid Asirvatham

    Database Systems

    Data Mining Tools

    Query-and-Reporting Tools use similar tools as QBE, SQL and report generation tools

    Intelligent Agents uses artificial intelligence tools such as neural networks and fuzzy logic to

    form the basis of information discovery e.g. Data/Logic is used by some Wall Street analyst

    e.g. Data Engine

    Multidimensional Analysis Tools

    is a slice-and-dice technique allows a user to view multidimensional information

    e.g. Forest & Trees (North Memorial Medical Centre which has 10,000daily patient records)