You are on page 1of 68

Data Base Management Systems

Lecture Overview
• Typical Components of a Database
Environment
• Database Architecture
• 3 – tier Architecture
• External View of the database
• Conceptual view of the database
• Internal view of the database
Component of Database Environment

• Different typical components of a database


environment are shown in the figures below;

• These figures describe graphically the role of


different types of users.
Database is used to store data and DBMS uses mechanisms to get data
from the database
Application programs talk to DBMS and ask for the data required
Database designers design (for large organizations) the database and install the DBMS
for use by the users of the database in any specific organization.
Once Database has been installed the DBA takes over the charge and performs
specific DBA related activities.
DBA interacts with other data base users
Schema
• Schema is a repository or structure to express
the format and other different information
about data and database.
OR
• The description of the database is called the
database schema.
University Database
Example of a Database Schema
(incomplete)
Example of a Database Schema
Data base Architecture

• Database standard architecture was proposed


by ANSI SPARK in 1975.
• The 3-tier architecture is being used as a
standered to develop new data base systems.
Advantages of 3 tier Architecture
• The objective of the three-level architecture is
to separate the users’ view,
– It allows independent customized user views
– It hides the physical storage details from users
– The database administrator should be able to
change the database storage structures without
affecting the users’ views.
– The internal structure of the database should be
unaffected by changes to the physical aspects of
the storage.
External View
• External View (Level, Schema or Model):
– This level is explicitly an end user level and
presents data as desired by the users of the
database. As it is known that the database users
are classified on two grounds
o Section of the organization

o Nature of Job of the users


External view
External view

• This is the view (or views) of managers


and other employees who are the
database users.
• External views are designed and create in
way that they can be modified at a later
stage without making any changes in the
logical or internal views.
Conceptual or Logical View:
• This schema combines the different external
views into a single, coherent, and comprehensive
definition of the organization’s data.
• The conceptual schema represents the view of
the data architect or data administrator.
• This is the level of database architecture which
contains the definition of all the data to be stored
in the database and also contains rules and
information about that structure and type of that
data.
• Complete description of the data stored.
Conceptual layer
Internal schema
• This is the level of the database which is
responsible for the storage of data on the
storage media and places the data in such a
format that it is only readable by the DBMS.
Inter-Schema Mappings

• The mechanism through which the records or


data at one level is related to the changed
format of the same data at another level is
known as mapping.
• External/conceptual mapping
• Conceptual/Internal mapping
Inter-Schema Mappings
Example of 3-Tier Architecture
Database Development Process:
Approach 1
Database Development Process:
Approach 2
Requirement Phase
Requirement analysis
• The tool used for the requirement analysis is
Data flow diagram.
Design Phase
Modeling reality
• A database must mirror the real world if it is to
answer questions about the real world
• Data Modeling is a design technique for capturing
reality

STUDENT

Social_Security_No
Name
Major
Data Models
• Data Model: Graphical systems used to
capture the nature and relationship among
data.
OR
• Data model is a set or collection of construct
used for creating a database and producing
designs for the databases.
Design Phase
Types of Data models
• Semantic Data Model
o ER- Data Model
o Object oriented data Model
• Record Based Data Model
o Hierarchical Data Model
o Network Data model
o Relational Data model
Types of Database Design
Conceptual database design: Implemented
using a semantic data model

Logical Database design: This design is


performed using a data model for which we
have a DBMS available and we are planning to
run our database system that DBMS
Cont…
Physical Database Design: The Logical design created using a
specific data model and created after the analysis of the
organization, it needs to be implemented in a physical DBMS
software so the Physical database design is performed and the
design created so far in the logical form are implemented on
that very DBMS.
Conceptual database design
A Good Data Name Is:

• Related to business, not technical, characteristics


• Meaningful and self-documenting
• Unique
• Readable
• Composed of words from an approved list
• Repeatable
• Written in standard syntax

37
Data Definitions
• Explanation of a term or fact
– Term–word or phrase with specific meaning
– Fact–association between two or more terms
• Guidelines for good data definition
– A concise description of essential data meaning
– Gathered in conjunction with systems
requirements
– Accompanied by diagrams
– Achieved by consensus, and iteratively refined
Entity relationship data model

• Entity relationship data model


A logical representation of the data for an
organization or for a business area.

• Entity relationship Diagram (ERD):


A graphical representation of an entity relationship
Model.
E-R Model Constructs
• Entities:
• Entity instance–person, place, object, event, concept (often
corresponds to a row in a table)
• Entity Type–collection of entities (often corresponds to a table)
• Relationships:
• Relationship instance–link between entities (corresponds to primary
key-foreign key equivalencies in related tables)
• Relationship type–category of relationship…link between entity
types
• Attributes:
• Properties or characteristics of an entity or relationship type (often
corresponds to a field in a table)
Sample E-R Diagram
Basic E-R notation

Entity Attribute
symbols symbols

A special entity
that is also a Relationship
relationship symbols

Relationship
degrees specify
number of
entity types Relationship
involved cardinalities
specify how
many of each
entity type is
allowed
Elements of an E-R diagram
WEAK ASSOCIATIVE
ENTITY
ENTITY ENTITY

MULTIVALUED DERIVED
ATTRIBUTE ATTRIBUTE
ATTRIBUTE

RELATIONSHIP INDENTIFYING
RELATIONSHIP
Entity
A person, place, object, event, or concept in the user
environment about which the organization wishes to
maintain data.
Person: Employee, student, Patient
Place: Store, Department, Inventory
Object: Machine, Building, Automobile
Event: Sale, Registration
Concept: Account, Course
Entities
The term entity is used in three different
meanings or for three different terms and that
are:
• Entity type
• Entity instance
• Entity set
Cont…
• Entity type: a collection of entities that share
common properties or characteristics.
• Entity Instance: A single occurrence of any
entity type.
• Entity Sets: A group of entity instances of a
particular entity type is called an entity set.
Example
An Entity…
• SHOULD BE:
• An object that will have many instances in the
database
• An object that will be composed of multiple
attributes
• An object that we are trying to model
• SHOULD NOT BE:
• A user of the database system
• An output of the database system (e.g., a
report)

48
Example of inappropriate entities

System System
user Inappropriate output
entities

Appropriate
entities

49
Strong vs. Weak Entities, and
Identifying Relationships
• Strong entity
• exists independently of other types of entities
• has its own unique identifier
• identifier underlined with single line
• Weak entity
• dependent on a strong entity (identifying owner)…cannot
exist on its own
• does not have a unique identifier (only a partial identifier)
• entity box and partial identifier have double lines
• Identifying relationship
• links strong entities to weak entities
50
Example of a weak identity and its identifying relationship

Strong entity Weak entity

51
Naming Entity Types
• Singular noun recommended, but still plurals can also be used

• Organization specific names, like customer or client, employee


or worker anything will work

• Write in capitals, yes, this is something that is generally


followed, otherwise will also work.

• Abbreviations can be used, be consistent. Avoid using


confusing abbreviations, if they are confusing for others
today, tomorrow they will confuse you too.
Symbols for Entity Types
Attribute
• An attribute of an entity type is a defining property or quality
of the instances of that entity type.

• Entity instances of same entity type have the same attributes.


(E.g. Student Identification, Student Name).

• An attribute is identified by a name allocated to it and that


has to be unique with respect to that entity type. However,
different entity types may have attributes with the same
name.
Attribute domain
• Domain is normally defined in form of data
type and some additional constraints like the
range constraint. Some common data types
are Integer, Float, Char, String, etc.
Attribute Symbol
Types of attributes
Attributes may be of different types. They may
be:
• Required versus Optional Attributes
• Simple or Composite
• Single valued or multi-valued
• Stored or Derived
• Identifier Attributes
Required vs. Optional Attributes

Required – must have a value for every Optional – may not have a value for every
entity (or relationship) instance with which it entity (or relationship) instance with which it
is associated is associated
Simple or Composite Attributes:
• An attribute that is a single whole is a simple attribute. The
value of a simple attribute is considered as a whole, not as
comprising of other attributes or components. E.g. Name,
FatherName, DateOfBorth of an entity type STUDENT
• An attribute consists of collection of other simple or
composite attributes then it is called a composite attributes.
For example, Address attribute may comprise of houseNo,
streetNo, areaCode, city etc.
Simple vs. Composite Attributes

Composite attribute – An attribute that has meaningful


component parts (attributes)

The address is
broken into
component parts

A composite attribute

60
Single valued or multi-valued
Attributes
• Some attribute have single value at a time, whereas some
others may have multiple values. For example, hobby
attribute of STUDENT or skills attribute of EMPLOYEE, since
a student may have multiple hobbies, likewise an employee
may have multiple skills so they are multi-valued attributes.

• On the other hand, name, father name, designation are


generally single valued attributes.
Stored or derived attributes
• Normally attributes are stored attributes, that is, their
values are stored and accessed as such from the database.
However, sometimes attributes’ values are not stored as
such, rather they are computed or derived based on some
other value. E.g. we may store the date of birth and age of
an employee is derived from DOB.
Multi-valued and Derived Attributes

Multivalued – may take on more than one Derived – values can be calculated from
value for a given entity (or relationship) related attribute values (not physically
instance stored in the database)

Entity with multivalued attribute (Skill) and derived attribute (Years Employed)

Multivalued Derived
an employee can Calculated
have more than one from date
skill employed
and current
date
Identifiers (Keys)

• Identifier (Key)–an attribute (or combination of


attributes) that uniquely identifies individual
instances of an entity type

• Simple versus Composite Identifier

• Candidate Identifier–an attribute that could be a


key…satisfies the requirements for being an identifier

64
Criteria for Identifiers
• Choose Identifiers that

– Will not change in value

– Will not be null

• Avoid intelligent identifiers (e.g., containing locations


or people that might change)

• Substitute new, simple keys for long, composite keys

65
Simple and composite identifier attributes

The identifier
is boldfaced
and underlined
Symbols for Attributes
Example entity type with attributes of different types

You might also like