0% found this document useful (0 votes)
31 views

Database Systems!: Data Model

This document provides an outline and overview of database systems and data modeling. It discusses major data models like the relational model, entity relationship model, and NoSQL model. It also covers topics like data abstraction, the basic structure of data models, and examples of one-to-one, one-to-many, and many-to-many relationships.

Uploaded by

hgj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Database Systems!: Data Model

This document provides an outline and overview of database systems and data modeling. It discusses major data models like the relational model, entity relationship model, and NoSQL model. It also covers topics like data abstraction, the basic structure of data models, and examples of one-to-one, one-to-many, and many-to-many relationships.

Uploaded by

hgj
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Database Systems!

Data Model

Dr. Seema Jehan
Outline!
•  Data Modeling

•  Process Modeling

•  Examples of Data models

•  Basic structure of a data model

•  Evolution of Major Data Models

•  The Relational Model

•  The Entity Relationship model

•  Object oriented model

•  XML model

•  NoSql Model
Major Topics of the Course!
•  Data Modeling
•  Process Modelling
•  Database Efficiency

Data Modeling!
•  The model represents a perception of structures
of reality.

Reality

Structures! Database Systems


Data Modeling
Model!
Processes!

•  The data modelling process is to fix a perception


of structures of reality and represent this
perception.

•  In data modeling we select aspects and we


abstract.
Process Modeling!
•  The model represents a perception of processes
of reality.
Reality

Structures! Process Database Systems


Modeling
Model!
Processes!

•  Processes may be represented


•  Embedded in program code
•  Executed ad hoc queries
Process Modeling!
PROG!
DML DML

•  The use of the model represents processes of


reality.

•  Processes may be represented


•  Embedded in program code
•  Executed ad hoc queries
Data Models!
•  Data Models
•  Data Structures
•  Constraints
•  Operations
•  Keys and Identifiers
•  Integrity and Consistency
•  Null Values
•  Surrogates
Example of Data Models!
•  A data model is not the same as a model of data!

•  Entity Relationship Model


•  Relational Model
•  Hierarchical Model
Data Abstraction!
•  Data Abstraction suppresses the details of data
organization and storage

•  Highlights the essential features for an improved


understanding of data.

•  Through data abstraction different users can perceive


data at their preffered level of detail.

•  A data model is a collection of concepts that can be used


to describe the structure of a database.
Importance of Data Modelling!
•  Data Modelling refers to the process of creating a specific
data model for a specific problem domain.

•  A model is an abstraction of a real-world object or event.


•  Data models can facilitate interaction among the
designer, the application programmer, and the end user.

•  A well-developed data model can help in a better decision


making.
Categories of a Data Model!
•  High level/ Conceptual Model
•  Conceptual data model use concepts like entities,
attributes, and relationships.

•  Physical Data Model


•  Representational Model/ Logical Model: Representational
data models hide many details of data storage on disk but
can be implemented on a computer system directly.

•  Logical models are most commonly used in traditional


commercial database

•  Example: Relational Data Model


Basic structure of a data
model!
• Entity
• An entity is a person, place, thing or event
about which data will be collected or
stored.

• Example: a Customer entity would have


many occurrences, such as Ayesha, Hina,
Ahmad

• Entities may be physical objects, such as


customers or products but they can also
be abstractions such as flight routes
Types of Data Models!
•  The Hierarchical/Network Models
•  The Relational Data Model
•  The Object-oriented Model
•  XML Model
•  NoSQL Model
The Hierarchical/Network
Model!
•  The
model was developed in 1960 to manage large
amounts of data

•  The basic logical structure is represented as an upside-


down tree

•  The network model was developed to represent complex


data relationships

•  The user perceives network as a collection of records in


1:M relationships.
The Relational Model!
•  Developed by IBM in 1970
•  It is based on mathematical set theory and represents data as
independent relations.

•  Each relation (table) is represented as a two-dimensional structure of


intersecting rows and columns

•  Tuple: In the relational model, a table row.


•  Relational Database Management System (RDMS) is a collection of
programs that manages a relational database.

•  Tables are related to each other through the sharing of a common


attribute
The Relational Model!
•  Example

AGENT_CODE AGENT_LNAME AGENT_FNAME AGENT_PHONE

CUST_CODE CUST_LNAME CUST_FNAME CUST_PHONE AGENT_CODE


100 ALI AYESHA 332424733

20010 ALI IMAN 331424733 100


101 AHMAD IFRAH 332734733

20011 SHAH ISMAIL 331734733 101


102 MOIN EISHA 332483733

20012 RAZA ALI 331483733 102

Table name: AGENT

Table name: CUSTOMER


The Relational Model!
•  The relationship type (1:1, 1:M, M:N) is shown in a
relational schema.

•  A relational diagram is a representation of relational


database’s entities, the attributes within those entities,
and the relationship between these entities.

AGENT! CUSTOMER!
! !
! 1 CUST_CODE!
AGENT_CODE! CUST_LNAME!
AGENT_LNAME! CUST_FNAME!
AGENT_FNAME! CUST_PHONE!
AGENT_PHONE! M AGENT_CODE!
The Relational Model!
•  Main reason for rise of the relational model is its structured
query language (Sql)

•  SQL allows user to specify what must be done without


specifying how.

•  From an end-user perspective, any Sql based relational


database application involves three parts:

•  The end-user interface: The interface allows user to interact


with the data.

•  A collection of tables in the database


•  SQL engine
The Entity Relationship
Model!
•  The relational model lacked features of an effective
database design tool.

•  Database designers prefer to use a graphical tool in which


entities and their relationships are modelled.

•  This led to the use of “Entity Relationship (ER)” Modelling


for data modelling.

•  ER models are normally represented as an “ Entity


Relationship Diagram (ERD)”

•  ERD uses graphical representation to model database


components.
The Entity Relationship
Model!
•  A data model that describes relationships(1:1, 1:M, and
M:N) among entities at the conceptual level with the help
of ER Diagrams.

•  The ER model is based on the following components:


•  Entity
•  Attributes
•  Relationships
Entity!
•  An Entity is represented in the ERD by a rectangle.
•  The name of the Entity, a noun, is written in the centre of the
rectangle.

•  The entity name is usually written in capital letters and in


singular form: PAINTER rather than PAINTERS, and
EMPLOYEE rather than EMPLOYEES.

•  When applying the ERD to the relational model, an entity is


mapped a relational table.

•  Each row in the relational table is known as an entity instance.


•  A collection of like entities is known as an entity set.
Attributes!
•  Each entity consists of set of attributes that describes
particular characteristics of the entity.

•  For example, the entity EMPLOYEE will have attributes


such as Social Security Number, a last name, and a first
name.
Basic structure of a data
model!
•  One-to-many:
•  A painter creates many different paintings, but each is
painted by only one painter.

•  In database terminology, PAINTER paints PAINTING as 1:M


•  CUSTOMER generates INVOICE
•  A customer generates many invoices but each invoice is
generated by one customer

CUSTOMER! 1 M INVOICE!
Relationships!
•  To describe associations among data.
•  Most relationships describe associations between two entities.
•  Three types of data relationships exist in ER modelling:
•  One-to-many (1:M)
•  Many-to-Many (M:M)
•  One-to-One (1:1)
•  The name of the relationship is usually an active or passive verb.
•  Example: a PAINTER paints many PAINTINGS
Example!
•  Many-to-many:
•  An employee learns many job skills, and each job skill may
be learned by many employees.

•  EMPLOYEE learns SkILL as M:N


•  STUDENT takes CLASS
•  A student can take many classes and each class can be
taken by many students

STUDENT! M N CLASS!
Example (contd.)!
•  One -to-one:
•  A retail company’s structure requires each store to be
managed by one employee.

•  EMPLOYEE manages STORE as 1:1


•  Database Relationships are bi-directional:
•  One customer can generate many invoices
•  Many invoices are generated by one customer
EMPLOYEE! 1 1 STORE!
Example (contd.)!
•  To properly identify the relationship type, ask two questions:
•  How many instances of B are related to one instance of A?
•  How many instances of A are related to one instance of B?
•  Example: Student - Class
•  In how many classes can one student en roll?
•  How many students can en roll in one class?

A! 1 1 B!
Relationships - ER Notations!
•  The Chen notation, the crow’s foot notation, class
diagram notation
The Object Oriented Model!
•  A data model whose basic modelling structure is an object.
•  An object is an abstract representation of a real-world
entity that has a unique identity, embedded properties, and
the ability to interact with other objects and itself.

•  An object-orienteddatabase management software used


to manage data in an object-oriented database model.

•  A class is a collection of similar objects with shared


structure (attributes) and methods.

•  Object-oriented data models are depicted using Unified


Modelling Language (UML) class diagrams.
The Object Oriented Model!
•  The OO data model is based on the following components:
•  An object is an abstraction of a real-world entity. It
represents only one occurrence of an entity.

•  Attributes define the properties of an object.


•  Objects that share common properties are grouped in
classes.

•  Classses are organised in a class hierarchy.


•  Inheritance is the ability of an object within a class
hierarchy to inherit the attributes and methods of the
classes above it.
Extended relational O/R DBMS !
•  OO and relational data models were developed in response to
different problems.

•  The OO data model was created to address specific engineering


needs, not the wide-ranging data management tasks.

•  The relational model was created with a focus on better data


management based on mathematical foundation.

•  Organisations that used XML data realised that they needed to


manage large amounts of unstructured data such as word-
processing documents, web pages, emails.

•  A DBMS based on the extended relational model (ERDM). This


relational model includes many of the object-oriented model’s best
features within an inherently simpler relational database structure.
Big Data /NoSQL Model!
•  The problem with the relational approach is that it does not
always match the needs of organisations with Big Data
challenges:

•  It is not always possible to fit social media, sensor-


generated data into the conventional relational structure of
rows and columns.

•  Data analysis based on OLAP tools are successful in


relational environments with highly structured data.
However, mining of useful data in the vast amount of
unstructured data collected from web sources require a
different approach.

•  Examples: Hadoop, MapReduce and NoSQL databases


NoSQL Databases!
•  A new generation of database management systems that
is not based on the traditional relational database model.

•  They support highly distributed database architectures


•  They provide high Scalability, availability and high
tolerance.

•  They support very large amounts of sparse data.


•  Allow a wide variety of approaches to data storage and
manipulation such as key-value stores, document
databases, columnar databases and graph databases.
The Evolution of Data Models!
Exercise!
•  Build ER model from the following requirements:
•  A PROFESSOR may teach many CLASSes, and each
CLASS is taught by only one PROFESSOR.

•  Each COURSE may generate many CLASSes, but each


CLASS references a single COURSE.

•  A CLASS requires one ROOM, but a ROOM may be


scheduled for many CLASSes.
Exercise- Solution!
Exercise- Solution!
Summary!
•  A data model is an abstraction of a complex real-world data environment.
•  Database designers use data models to communicate with programmers
and end users.

•  The basic data modeling components are entities, attributes, relationships


and constraints.

•  The network/hierarchical models are not used anymore.


•  The relational model is the current database implementation standard.
•  In the relational model, the end user perceives the data as being stored in
tables.

•  ER model is a graphical tool for data modelling that complements the


relational model .
References!
•  Chapter 2, Database Systems, Design, Implementation
and Management, 13th Edition, 2019

You might also like