Professional Documents
Culture Documents
3: Database Concept
Srawan Kumar KC
Full Time Faculty ( Computer and IT ), LACM
Learning Objectives
Database :
• But direct (or random) access media (like disks) use other
techniques:
Database
Index
College Name of GPA
LACM
Student
KCM
NCM LACM Rosha 3.8
LACM Hemant 4.0
LACM Priyanka 3.8
KCM Pawan 2.9
KCM Ojaswee 3.6
KCM Manjila 3.8
NCM Nirbachan 3.8
NCM Neha 2.6
1). Basic of data arrangement and access :
• It stores data in plain text files and is also called flat file
system.
Data Redundancy :
Data Inconsistency :
• The various copies of the same data may no longer agree.
• For example, a changed customer address may be reflected in
savings-account records but not elsewhere in the system.
2). Traditional File Environment :
Data Isolation:
Integrity Problems:
Security Problems :
Conceptual Design:
Physical Design:
TG 3 21
3) Database : The Modern Approach
Entity Relation Modelling
c) Instance:
d) Attributes / Identifier:
f) Relationships:
One-to-One
In a 1:1 (one-to-one) relationship, a single-entity instance of
one type is related to a single-entity instance of another type.
One-to-Many
In a 1: M (one-to-many) relationship, a single-entity instance of
one type is related to many-entity instance of another type.
Many-to-Many
In a M:M (many-to-many) relationship, many-entity instance of
one type is related to many-entity of another type and vice
versa.
3) Database : The Modern Approach
Entity Relation Modelling
3) Database : The Modern Approach
Normalization :
a) Minimum redundancy
b) Maximum data integrity
c) Best processing performance
3) Database : The Modern Approach
Normalization :
Consider the employee table given below:
Normalization :
a) Centralized Database
b) Distributed Database
3) Database : The Modern Approach
Locating Data in Database
a) Centralized database:
Why DBMS ?
2) Concurrency Management :
• Concept that is used to address conflicts with the
simultaneous accessing or altering of data that
can occur with a multi-user system.
4) Security :
5) Storage Management :
• Conflict resolution
b) Physical view :
b) Database Schema:
e) Data Dictionary:
Slide 1-51
Logical Data Models
Hierarchical Data Model:
◦ A hierarchical database model is a data model in which the
data is organized into a tree-like structure.
◦ The structure allows representing information using
parent/child relationships: each parent can have many
children, but each child has only one parent. All attributes
of a specific record are listed under an entity type.
◦ Hierarchical database model rigidly structures data into an
inverted “tree” in which each record contains two elements,
a single root or master field, often called a key, and a
variable number of subordinate fields.
Slide 1-52
Logical Data Models
Hierarchical Data Model:
◦ The strongest advantage of the hierarchical database
approach is the speed and efficiency with which it can be
searched for data.
◦ The hierarchical model does have problems: Access to data
in this model is predefined by the database administrator
before the programs that access the data are written.
Programmers must follow the hierarchy established by the
data structure.
◦ It can not handle many to many relationship
Slide 1-53
Logical Data Models
Hierarchical Data Model:
Slide 1-54
Logical Data Models
Network Data Model:
◦ The network model is a database model conceived as a flexible
way of representing objects and their relationships.
◦ Its distinguishing feature is that the schema, viewed as a graph
in which object types are nodes and relationship types are arcs.
◦ Unlike hierarchical model, the network model allows each
record to have multiple parent and child records, forming a
lattice structure. The network model replaces the hierarchical
tree with a graph thus allowing more general connections
among the nodes. This model was evolved to specially handle
non-hierarchical relationships. Now, same data may exist in
two different levels.
Slide 1-55
Logical Data Models
Network Data Model:
◦ Support many-to-many relationship
◦ Good processing speed but very complex model to design,
implement and maintain
Slide 1-56
Logical Data Models
Relational Data Model
◦ Relational data model represents the database as a collection of
relations where each relation resembles a table of values with
rows and columns.
◦ A relation may be regarded as a set of tuples, also called
records. A relation consists of relation schema & relation
instance. The relation schema specifies relation name &
description of tuples (name of attributes, domain). While
relation instance corresponds to a table of rows & columns
where each row is a tuple & the column is the attribute.
◦ Major advantages of relational model over the older data
models are the simple data representation & the ways complex
queries can be expressed easily.
Slide 1-57
Logical Data Models
Relational Data Model
◦ Consider a relation representing employee record as;
Employee
Eid Name Address Depart_no
011 Ram Sing Kathmandu D01
012 Hari Saha Pokhara D02
◦ The relational model of data permits the database designer to
create a consistent, logical representation of information.
Consistency is achieved by including declared constraints in the
database design, which is usually referred to as the logical
schema. The theory includes a process of database
normalization whereby a design with certain desirable properties
can be selected from a set of logically equivalent alternatives
Slide 1-58
Three basic operations of a relational database
a) Hierarchical Database
b) Network Database
c) Relational Database
d) Object-Oriented Database
a) Hierarchical Database
Examples:
Applications :
For example,