0% found this document useful (0 votes)
3 views30 pages

Data Model Updated

Uploaded by

zelalemdemse723
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views30 pages

Data Model Updated

Uploaded by

zelalemdemse723
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Data Model

CS341
Topics
 What is a Data Model?
 Levels of Data Model
 Data Independence
 Schema Mapping
 Types of Data models
 History of Database Systems

2
Data Model
 Data Model is an integrated collection of concepts for
describing
 Data
 Relationships between data, and
 Constraints on the data
 The purpose of a Data Model is to represent data in an
understandable way
 Data Model comprises:
 a structural part;
 a manipulative part;
 possibly a set of integrity rules.

3
Data Model (cont.)
 A data model is a collection of descriptions for data, data
relationships, and constraints
 These descriptions are called schema
 Each schemas represents different level of abstraction
 Several schemas (levels of description) are used
 A data model provides a way to describe the design of a
database at the physical, logical, and view level
 Physical schema describes the database design at the internal
level (at the file level)
 Logical schema describes the database design at the conceptual
level
 A database may also have several schemas at the view level
(external level)
 These schemas describe different user views of the database
4
Data Model (cont.)

5
ANSI-SPARC Model - Architecture

6
3-Level Model
 External Data Model
 Represent each user’s view of the organization
 Describes the part of database that is relevant to a particular
user
 Conceptual Data Model
 Represent the logical (or community) view
 A complete and accurate representation of an organization’s
data requirements
 Describes what ALL the data that is stored in database including
the relationships among the data and constraints
 It is independent of the target DBMS
 Programmers construct applications by using the conceptual
schema

7
3-Level Model (cont.)
 Internal Data Model
 Physical representation of the database on the computer
 Describes how the data is stored in database files
 This is how the OS and DBMS view Data
 The physical schema is hidden beneath the logical schema
 The internal schema can usually be changed without affecting
application programs

8
3-Level Model - Example

9
3-Level Model - Objectives
 All users should be able to access same data
 But each user may see it in different forms
 A user’s view is immune to changes made in other user’s
views.
 Users should not need to know physical database
storage details
 The conceptual structure of database can be changed
without affecting all users
 It should be possible to change database storage
structures (internal structure) without affecting the users’
views

10
Data Independence
 Main Concept of Data Independence is that UPPER
layers are immune to changes in the lower layers
 Data independence means that programs are isolated
from changes in the way the data are structured and
stored.
 The database management system provides the
interface between the application programs and the data
 For example
 In traditional file processing system: If we add a new attribute
or change index structure then applications are affected
 But in a DBMS environment these changes are reflected in the
catalog, as a result the applications are not affected

11
Logical Data Independence
 Logical Data Independence refers to immunity of
external schemas to changes in conceptual schema.
 Changes in the Conceptual schema should not require
changes to external schema or rewrites of application
programs
 It is the ability to modify the logical schema without
causing application program to be rewritten
 Example
 Addition or removal of attributes or tables
 Obviously some users my be affected, but not all users

12
Physical Data Independence
 Physical Data Independence refers to immunity of
conceptual schema to changes in the internal schema.
 Internal schema changes should not require change to
conceptual or external schemas
 Example:
 Different file organizations (storage structures) may be used by
different DBMSs, but this should not require changes of the
conceptual schema or application programs
 Application programs need not be rewritten if the
physical schema changes

13
Schema Mapping
 Schema Mapping facilitates Data Independence
 The DBMS is responsible for mapping between the three
types of schema
 External/Conceptual Mapping
 This enables the DBMS to map names in the user’s view on to
the relevant part of the conceptual schema.
 Conceptual/Internal Mapping
 This enables the DBMS to find the actual record or combination
of records in physical storage that constitute a logical record in
the conceptual schema
 Any constraint to be enforced on the operations for that logical
record will also be included

14
Schema Mapping (cont.)

15
Types of Data Models
 Hierarchical Data Model
 Network Data Model
 Relational Data Model
 Object-Relational
 Object-Oriented

16
History of Database Systems
 First-generation: 1960’s
 Hierarchical and Network Model
 Second generation: 1970’s
 Relational Model
 Third generation: 1980’s
 Object-Relational Model
 Object-Oriented Model

17
1st Generation Data Models
 Hierarchical and Network Model
 Navigational and procedural approach to data processing
 Treat records as individual objects linked with pointers
 Need to know the physical Database to access the data
 Both kinds of DBMSs were accessible from the
programming language (usually Cobol) using a low-level
interface
 Made some basic tasks controllable, but still complex
and time-consuming
 creating an application
 maintaining the database
 tuning and development

18
Hierarchical Data Model
 Record type is referred to as node
 The top node is the root node
 Nodes are arranged in a hierarchical structure
 Like an inverted tree
 A parent node can have more than one child node
 A child node can only have one parent node
 The relationship between parent and child is one-to-many
 Relation is established by creating physical link between
stored records
 Relationships are implemented as pointer
 To add new record type or relationship, the database
must be redefined and then stored in a new form.

19
Hierarchical Data Models (cont.)

20
Network Data Model
 Allows record types to have more than one parent
 unlike hierarchical model
 A network data models sees records as set members
 Each set has an owner and one or more members
 Allows many to many relationship between entities
 Like hierarchical model network model is a collection of
physically linked records.
 Allow member records to have more than one owner

21
Network Data Model (cont.)

22
2nd Generation Data Models
 Relational DBMS - 1970 Edgar F. Codd
 Data in a database could be represented as a tabular
structure
 Using tables with columns and rows
 These tables were called relations
 Tables can be accessed using a high-level non-
procedural (or declarative) language
 Instead of writing algorithms to access data
 The approach only needs a predicate (condition) that identified
the desired records or combination of records.
 In the beginning of the 1980s several Relational DBMS
(RDBMS) products emerged
 e.g. Oracle, Informix, Ingres and DB2

23
Relational Data Model
 The idea of a relation is modelled on a mathematical
construct
 Based on the concept of RELATION
 Relation: Two dimensional table
 The database is seen as a collection of tables
 Stores data in the form of tables  rows and columns
 A row of the table is called tuple equivalent to record
 Columns are called attribute equivalent to fields
 Data value is the value of the Attribute
 Records are related by the data stored jointly in the fields
of records in two tables.
 Uses Declarative (as opposed to Procedural) approach to
database processing
 Treats records as a Group (Set)
24
Relational Data Model (cont.)
CODD’S 12 Rules (extract)
 Every relation in a database must have a distinct name
 Every column in a relation must have a distinct name
within the relation
 All entries in a column must be of the same kind
 They are said to be defined on the same domain
 The ordering of columns in a relation is not significant
 Each row in a relation must be distinct
 Duplicate rows are not allowed in a relation
 The ordering of rows is not significant
 Each cell or column/row intersection in a relation should
contain only an atomic value
 Multiple-values are not allowed in the cells of a relation
25
Relational Data Model (cont.)

26
Relational Data Model (cont.)
 Relational Data Model uses SQL (structured query
language) for defining and manipulating data
 Data Definition Language (DDL)
 Used to CREATE and make changes to database objects:
 entities, attributes, and relationships
 integrity and security constraints

 Data Manipulation Language (DML)


 Provides basic data manipulation operations on data held in the
database
 allows user to tell system exactly how to manipulate data
 Non-Procedural language - allows user to state what data is
needed rather than how it is to be retrieved.

27
Functions of a RDBMS
 Data Storage, Retrieval, and Update
 A User-Accessible Catalog
 Transaction Support
 Concurrency Control
 Recovery Services
 Authorization Services
 Support for Data Communication
 Integrity Services
 Services to Promote Data Independence
 Other Utility Services( Import/Export, Task scheduler,
…etc)
28
System Catalog
 Repository of information (metadata) describing the data
in the database.
 One of the fundamental components of DBMS.
 Typically stores:
 Names, types, and sizes of data items;
 Constraints on the data;
 Names of authorized users;
 Data items accessible by a user and the type of access;
 Usage statistics.

29
3rd Generation Data Models
 Object-Relational
 Object-relational DBMS (ORDBMS)
 Includes some object-oriented features and encapsulate these
features into an RDBMS
 extend the capabilities of an RDBMS to include support for richer
object structures
 Object-Oriented
 OODBMSs
 Offer persistence to objects, including the object’s associations
and methods.

30

You might also like