Database Model

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 31

1

Database Model
1

Database vs. File Systems


Figure 1.6

2
1

The Importance of Data Models

• Data model
–Relatively simple representation, usually graphical,
of complex real-world data structures

–Communications tool to facilitate interaction among


the designer, the applications programmer, and the
end user
• Good database design uses an appropriate data
model as its foundation

3
1
Importance of Data Modeling

• End-users have different views and needs for


data

• Data model organizes data for various users

4
1
Data Model Basic Building Blocks

• Entity is anything about which data are to be


collected and stored

• Attribute is a characteristic of an entity

• Relationship describes an association among


(two or more) entities
–One-to-many (1:M) relationship
–Many-to-many (M:N or M:M) relationship
–One-to-one (1:1) relationship

5
1

Database Models
• Collection of logical constructs used to represent
data structure and relationships within the
database

6
1
Implementation Database Models

• Hierarchical Model : data model based on trees.

• Network Model: data model based on graphs with


records as nodes and relationships between records
as edges.

• Relational Model : data model based on tables

• E-R Model : data model based on entiities and their


relationship

7
1
Hierarchical Database Model
• Logically represented by an upside down tree
– Each parent can have many children
– Each child has only one parent

• The hierarchical structure contains levels , or


segments.

• A segment is the equivalent of a file system`s


record type.

• This model depicts a set of one to many (1:M)


relationship.

8
1

Figure 1.8

9
1

Hierarchical Database Model


• Advantages
– Conceptual simplicity
– Database security and integrity
– Data independence
– Efficiency with 1:M relationship
• Disadvantages
– Complex implementation
– Difficult to manage and lack of standards
– Lacks structural independence
– Complex applications programming and use
– Implementation limitations
10
1

Network Database Model

• Each record can have multiple parents


– Composed of sets
– Each set has owner record and member record
– Member may have several owners

• Was created to represent complex data


realtionship more effectively than the hierarchical
model , to improve database performance , and to
impose a database standards.

11
1

Network Database Model (cont..)

• This model is generally not used today.


• Some important terms are:

• Schema: overall design of a database. or conceptual


design of the entire database as viewed by the
database adminstrator.

• subschema: defines the portion of the database


"seen" by the application programs that actually
produce the desired informaton from the data
contained within the database.
12
1

Network Database Model (cont..)

• DML (Data Management Language) : defines the


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

• DDL(Data Definition language) : enables the


database administrator to define the schema
componenets

13
1

Figure
1.10
14
1

Network Database Model


• Advantages
– Conceptual simplicity
– Handles more relationship types
– Data access flexibility
– Promotes database integrity
– Data independence
– Conformance to standards
• Disadvantages
– System complexity
– Lack of structural independence
15
1

Relational Database Model

• Perceived by user as a collection of tables for


data storage
• Tables are a series of row/column intersections
• Tables related by sharing common entity
characteristic(s)

16
1

The Relational Model

• Developed by Codd (IBM) in 1970.

• Considered ingenious but impractical in 1970.

• Conceptually simple.

• Computers lacked power to implement the


relational model.

• Today, microcomputers can run sophisticated


relational database software.

17
1

The Relational Model—Basic Structure

• Relational Database Management System


(RDBMS).

• Performs same basic functions provided by


hierarchical and network DBMS systems, plus
other functions.

• Most important advantage of the RDBMS is its


ability to let the user/designer operate in a human
logical environment

18
1
The Relational Model—
Basic Structure (continued)
• Table (relations)
–Matrix consisting of a series of row/column
intersections.
–Related to each other by sharing a common entity
characteristic.
• Relational schema
–Visual representation of relational database’s entities,
attributes within those entities, and relationships
between those entities.

19
1

Relational Table

• Stores a collection of related entities


–Resembles a file

• Relational table is purely logical structure


–How data are physically stored in the database is of no
concern to the user or the designer
–This property became the source of a real database
revolution

20
1

A Relational Schema

21
1
Linking Relational Tables

22
1

Relational Database Model


• Advantages
– Structural independence
– Improved conceptual simplicity
– Easier database design, implementation,
management, and use
– Ad hoc query capability with SQL
– Powerful database management system

23
1

Relational Database Model


• Disadvantages
– Substantial hardware and system software
overhead
– Poor design and implementation is made easy
– May promote “islands of information” problems

24
1

RDMS

• The RDBMS uses SQL to translate user queris into


instruction for retrieving the requested data.
• SQL base relational database involves three parts:
– End user interface: allows the end user to intteract
with the data.
– Collection of tables stored in the database: all data
are perceived to be stored in tables.
– SQL engine: Largely hidden from the end user, , the
SQL engine executes all queries , or data request.

25
1

Entity Relationship Database Model


• Complements the relational data model concepts
• Represented in an entity relationship diagram
(ERD)
• Based on entities, attributes, and relationships

Figure 1.13

26
1

Entity Relationship Model (cont..)

• Widely accepted and adapted graphical tool for


data modeling
• Introduced by Chen in 1976.
• ER models are normally represented in an enitity
relationship diagram (ERD), which uses graphical
representations to model database components.

27
1

Componenet of ER Model

• Entity :
– anything about which data are to be collected and
stored.
– An entitiy is represented in ERD by a rectangle, also
known as entity box.
– Each entity is described by a set of attributes that
describes particular characterstics of the entity.
• Relationships:
– three types of relationship (1:M , M:M , 1:1)

28
1

Relationships: The Basic Chen ERD

29
1
Relationships:
The Basic Crow’s Foot ERD

30
1

Entity Relationship Database Model


• Advantages
– Exceptional conceptual simplicity
– Visual representation
– Effective communication tool
– Integrated with the relational database model
• Disadvantages
– Limited constraint representation
– Limited relationship representation
– No data manipulation language
– Loss of information content
31

You might also like