• No results found

Lecture 03

N/A
N/A
Protected

Academic year: 2020

Share "Lecture 03"

Copied!
33
0
0

Loading.... (view fulltext now)

Full text

(1)

Lecture 03

Data Models

(2)

Databases are needed to maintain, analyze and to perform reporting on data.

Database: An organized collection of logically related data.

Metadata: Data that describes data.

• Advantages of DB: Data Independence/Reduced Maintenance, Improved Data Sharing, Increased Application Development Productivity, Enforcement of Standards, Improved Data Quality (Constraints), Better Data Accessibility/ Responsiveness,Security, Backup/Recovery and Concurrency.

• A DBMS is software used to create, store, retrieve and maintain the database. E.g Microsoft Access, Microsoft SQL Server and Oracle are examples of Database Management Systems

21

2

(3)

Introduction to Data

Models

Chapter 1

Book: "Database Systems: Design,

Implementation, and Management" by Carlos Coronel, Steven Morris, 13th edition.

(4)

Data Modeling and Data

Models

Data Model

Relatively simple representation of

complex real-world

data structures

(Usually graphical)

A

“blueprint”

containing all the instructions to build a

database that will

meet all end-user requirements

.

Data Modeling

Process of

creating a data model

for a determined

problem domain

First step in

designing a database

An iterative, progressive process, that starts as simple

model and goes into much detail as the understanding

of the problem domain increases

(5)

Importance of Data Models

Are a communication tool

Give an overall view of the

database

Organize data for various

users

Are an abstraction for the

creation of good database

(6)

Importance of Data

Models

Facilitate interaction

among designer,application

programmer and the end-user. (communication

tool)

Improved understanding

of the organization for

which the database design is developed.

Without a model,

data view will be different

for

different levels of employees, manager, clerk,

president, application programmers and for different

departments. Example:

• “blind people and the elephant” analogy

• A house is not a random collection of rooms

When a good database blueprint is available, differences in view of data by different employees/departments do not matter anymore.

(7)

• Entity

• Anything about

which data are to be collected and

stored (a person, a place, a thing, or an event).

Example: CUSTOMER

• Each entity occurrence is unique and distinct

• Attribute

• A

characteristic

of an entity

(Example: customer name, customer phone number,

etc.)

• Relationship

• Describes an

association among

entities

(For example, a relationship between customers and

agents can be described as “an agent can serve

many customers”)

5

(8)

Basic Building Blocks of Data Model

• One-to-many (1:M or 1..*) relationship

• PAINTER paints PAINTING

(A painter paints many different paintings) • CUSTOMER generates INVOICE

(each invoice is generated by only one customer)

• Many-to-many (M:N or *..*) relationship

• EMPLOYEE learns SKILL

(An employee may learn many job skills, each job skill may be learned by many employees)

• STUDENT takes CLASS

• One-to-one (1:1 or 1..1) relationship

• EMPLOYEE manages STORE

(each store is managed by single employee, each store manager, who is an employee, manages only a single store)

(9)

Basic Building Blocks of Data Model

• Constraint

• A restriction placed on the data

• Helps ensure data integrity

• Examples:

• A student’s GPA must be between 0.00 and 4.00 • Each class must have one and only one teacher • An employee’s salary must be between 6,000 and

350,000

(10)

Business Rules

Brief, precise, and unambiguous

description of a policy, procedure, or

principle

Enable defining the basic building

blocks

Describe main and distinguishing

characteristics of the data

(11)

Business Rules

• A brief, precise and unambiguous

description of a

policy, procedure, or principle

within a specific

organization.

(Note: an organization could be a business, government unit, research laboratory, university, etc. that stores and uses data to generate information)

• Used in defining entities, attributes, relationships and

constraints.

• Nouns for entities, verbs for relationships

(12)

Business Rules

Examples:

1. A customer may generate many invoices

2. An invoice is generated by only one customer

3. A training session cannot be scheduled for fewer than 10 employee or more than 30 employees

• Entities: CUSTOMER, INVOICE, EMPLOYEE, TRAINING

• Relationships: 1:M between CUSTOMER and INVOICE, M:N

between EMPLOYEE and TRAINING

• Constraint: No fewer than 10, no more than 30 employees in training

(13)

Evolution of database technologies

2000 and beyond – multi –tier, client-server, distributed environments, web-based, content-addre ssable storage, data mining

(14)
(15)

Evolution of Data Models

(contd.)

1. Hierarchical Model (1960s)

• To manage large amount of data for

complex

manufacturing

projects such as Apollo rocket that

landed on the moon in 1969

• Logical Structure represented by an upside down

tree

• Contains

levels or segments

(segment = file system’s record type)

• 1:M relationships (1 parent: many child)

• Lack of ad hoc query

capability

10

o C is parent of G and H o G and H are children of C

(16)

Evolution of Data Models (contd.)

2. Network Model

• To represent complex

data relationships more

effectively

than the hierarchical model

• To improve

database performance

and to impose

database standards.

• Allowed a record to have more than one parent

• Lack of ad hoc query capability

• Generally not used today

but the definitions of

standard database

concepts that emerged with

the network model are still

used by modern data

models.

16

o B and C are parents of F o F is child of both B and C

(17)

Concepts that emerged with the Network

Model

17

Schema

Conceptual organization of the entire database as viewed by the DBA.

Subschema

Defines a portion of the database as seen by the application programs producing desired information from the data within database.

Data Management Language (DML)

Defines the environment in which data can be managed and to work with the data in the database.

Data Definition Language (DDL)

(18)

Evolution of Data Models

(contd.)

3. Relational Model

• Introduced by

E. F. Codd (of IBM) in 1970

• Major breakthrough, a database revolution

• Based on

mathematical concept “relation

• Relation =

matrix (table)

consisting of

tuples

(rows)

and

attributes (columns)

• Tables are related through a

common attribute

(Fig.

2.1)

• Relational Database Management Systems (RDBMS)

• Used Relational Diagrams (Fig. 2.2)

• Introduced Structured Query Language (SQL)

• (Will cover in more detail in coming lectures)

(19)

3. Relational Model

• Relation or table: Matrix composed of

intersecting tuple and attribute

– Tuple: Rows

– Attribute: Columns

(20)

3. Relational Model

(example)

(21)

3. Relational Model

(example)

(22)

Evolution of Data Models

(contd.)

Entity Relationship Model (ERM)

Widely

accepted standard

for data modeling

Peter Chen

introduced ER data model in 1976

Graphical representation of entities

and their

relationships in a database structure

Represented in a

Entity Relationship Diagram

(ERD)

Entity:

represented by

rectangle, capital letters

,

singular form,

each row called Entity Instance

or

Entity Occurrence

Relationships:

describes

association among data

(Fig. 2.3)

(Will cover in more detail in coming lectures)

(23)

Entity Relationship Diagram (ERD)

(24)

Evolution of Data Models

(contd.)

Object-Oriented Model (OO Model)

• Complex real-world problems needed a data model that more

closely represents the real world.

• Both data and their relationships are contained in a single structure called object. (Fig. 2.4)

• Said to be a semantic data model because semantic indicates meaning. Based on following components:

• Object: one occurrence of an entity

• Class: collection of similar objects with shared attributes and methods

• Attributes: properties of objects

• Method: class procedures representing actions: finding, changing,

printing

• Class Hierarchy: upside-down tree, each class has one parent.

Example: CUSTOMER and EMPLOYEE share a parent PERSON class.

• Inheritance: ability of object within class hierarchy to inherit attributes

(25)

Object-Oriented Model (OO Model) example

(26)

Evolution of Data Models

(contd.)

Newer Data Models: Object/Relational and

XML

• Demand to support more complex data representations gave rise to Extended Relational Data Model (ERDM).

• ERDM gave birth to a new generation of relational databases supporting OO features.

• With emergence of internet as a business communication tool, Extensible Markup Language (XML) emerged as the efficient exchange of structured, semi-structured and

unstructured data.

• To address the need of managing large amounts of

unstructured data such as word-processing documents, Web pages, emails and diagrams, XML databases emerged.

• At the same time, O/R DBMSs added support for XML-based documents within their relational data structure.

(27)

27

Hierarchical Model

Advantages

Disadvantages

Promotes data sharing

Parent/child relationship

promotes conceptual

simplicity and data

integrity

Database security is

provided and enforced

by DBMS

Efficient with 1:M

relationships

• Requires knowledge of

physical data storage characteristics

• Navigational system requires

knowledge of hierarchical path

• Changes in structure require

changes in all application programs

• Implementation limitations

• No data definition

(28)

28

Network Model

Advantages

Disadvantages

• Conceptual simplicity

• Handles more relationship

types

• Data access is flexible

• Data owner/member

relationship promotes data integrity

• Conformance to standards

• Includes data definition

language (DDL) and data

manipulation language (DML)

System complexity limits

efficiency

Navigational system

yields complex

implementation,

application

development, and

management

Structural changes

require changes in all

application programs

(29)

29

Relational Model

Advantages

Disadvantages

• Structural independence is

promoted using independent tables

• Tabular view improves

conceptual simplicity

• Ad hoc query capability is

based on SQL

• Isolates the end user from

physical-level details

• Improves implementation and

management simplicity

Requires substantial

hardware and system

software overhead

Conceptual simplicity

gives untrained people

the tools to use a good

system poorly

May promote

(30)

30

Entity Relationship Model

Advantages

Disadvantages

• Visual modeling yields

conceptual simplicity

• Visual representation makes it

an effective communication tool

• Is integrated with the

dominant relational model

• Limited constraint representation • Limited relationship representation • No data manipulation language

• Loss of information content

occurs when attributes are removed from entities to avoid crowded displays

(31)

31

Object-Oriented Model

Advantages

Disadvantages

• Semantic content is added

• Visual representation includes semantic content

• Inheritance promotes data integrity

• Slow development of

standards caused vendors to supply their own

enhancements

Compromised widely

accepted standard

• Complex navigational system • Learning curve is steep

• High system overhead slows transactions

(32)

Conclusio

n

In this Chapter, we…

Introduced what data modeling and data model is

Discussed the importance of data models

Explained the building blocks of a data model

Described what business rules are and listed

examples

Covered Evolution of Data Models

Briefly went over several types of data models

(33)

References

Related documents

Funding: Black Butte Ranch pays full coost of the vanpool and hired VPSI to provide operation and administra- tive support.. VPSI provided (and continues to provide) the

In examining the versatility of the Contract record, this article will explain how Contracts are limited in terms of quantity, value, and time, as well as how a single Contract can

T h e second approximation is the narrowest; this is because for the present data the sample variance is substantially smaller than would be expected, given the mean

This paper presents the primary analysis of programmatic data, as well as demographic, behavioral, and clinical data from the TAPS Demonstration Project

This is because space itself is to function as the ‘form’ of the content of an outer intuition (a form of our sensi- bility), as something that ‘orders’ the ‘matter’

These include the pressure on managers to increase productivity, reduce cost, improve customer service at least cost to the environment whilst ensuring the health and

An unparalleled system of continuous training that has become definitive - the Sassoon brand continues to evoke the best in hair education - and the release of two seasonal hair

However case study evidence suggests that unions tend to be more opportunistic in the selection of organising and recruitment campaign targets so may be more likely to concentrate