21CSC205P DBMS UNIT I (1)
21CSC205P DBMS UNIT I (1)
Systems
Outline of the Presentation
Issues in File Processing System
Need for DBMS
Basic terminologies of Database
Database system Architecture
Various Data models
ER diagram basics and extensions
Construction of Database design using Entity Relationship diagram for University Database,
Entity Relationship diagram for Banking System, Information System
File Processing System
Data redundancy
Data inconsistency
Limited Data Sharing
Data Dependency
Lack of Data Integrity
Limited Security
Concurrency Control
Scalability Issues
Limited Query Capabilities
File Processing System
Data redundancy
Problem: Data is often duplicated across various files. This redundancy can lead to
inconsistencies and increase the likelihood of data errors.
Impact: Wasted storage space, increased maintenance efforts, and the risk of
inconsistent data.
Data inconsistency
Problem: Changes made to data in one file may not be reflected in other related files.
This inconsistency can lead to inaccurate reporting and decision-making.
Impact: Unreliable information, potential for errors, and difficulties in maintaining data
integrity.
File Processing System
Data Dependence
Problem: Programs are often written to access specific files directly. If the structure of a
file changes, it may require modifying all programs that use that file.
Impact: High maintenance costs, inflexibility in adapting to changing data structures, and
increased risk of errors during updates.
File Processing System
Impact: Lower data quality, increased chances of errors, and difficulties in ensuring the
accuracy of information.
Limited Security
Problem: File systems often have limited security measures. Access controls are typically
basic, and there's a higher risk of unauthorized access.
Concurrency Control
Problem: Ensuring concurrent access to data by multiple users without conflicts is challenging. File systems
may lack mechanisms to handle concurrent updates properly.
Impact: Data corruption, lost updates, and challenges in maintaining data consistency in a multi-user
environment.
Scalability Issues
Problem: As the volume of data grows, file processing systems may struggle to handle large datasets
efficiently. Performance issues can arise.
Impact: Reduced system performance, longer processing times, and challenges in scaling the
system.
Limited Query Capabilities:
Problem: File processing systems often lack a query language and sophisticated querying capabilities.
Retrieving specific information can be cumbersome.
Impact: Inefficient data retrieval, increased complexity in generating reports, and challenges in extracting
meaningful insights.
Introduction and applications of DBMS
No redundant data
Data Consistency and Integrity
Data Concurrency
Data Security
Data Privacy
Easy access to data
Data Recovery
Flexible
Introduction and applications of DBMS
Applications of DBMS
Purpose of database system
Purpose of DBMS:
The purpose of DBMS is to transform the following −
DATA
Purpose of DBMS:
The diagram given explains the Information
process as to how the transformation
of data to information to knowledge to
action happens respectively in the
DBMS knowledge
Action
( Processing)
Basic terminologies of Database
Database - A collection of organized data that is stored and can be easily accessed,
managed, and updated.
Table - A collection of data organized in rows and columns. Tables are the basic structure
in a relational database.
Row or Record - A single entry in a database table that contains data related to a
specific entity or object.
Primary Key - A unique identifier for each record in a table. It ensures that each row
can be uniquely identified and retrieved.
Basic terminologies of Database
Foreign Key - A column in a table that refers to the primary key in another table. It
establishes a link between two tables, enforcing referential integrity.
Index - A data structure that improves the speed of data retrieval operations on a
database table.
Query - A request for data retrieval or manipulation from a database. Queries are typically
written in a query language like SQL (Structured Query Language).
Relational Database - A type of database that uses a tabular structure to organize data,
and relationships between tables are defined.
SQL (Structured Query Language) - A programming language used for managing and
manipulating relational databases. It includes commands for querying, updating, and
managing databases.
Basic terminologies of Database
Schema - The structure or blueprint that defines the organization of data in a database,
including tables, fields, relationships, and constraints.
Data Dictionary - A centralized repository that stores metadata about the database,
including information about tables, columns, data types, and relationships.
DATABASE SYSTEM ARCHITECTURE
There are four types users
accessing / managing the
database
Naïve Users
Application Programmers
Sophisticated Users
Database Administrators
The database system is divided
into three components:
Query Processor
Storage Manager
Disk Storage.
DATABASE SYSTEM ARCHITECTURE
Query Processor : It interprets the requests (queries) from user(s) via an
application program /interface into instructions.
It also executes the user request which is received from the DML
compiler. Query Processor contains the following components
DATABASE SYSTEM ARCHITECTURE
Storage Manager :
It is an interface between the information stored in the database
an and the requests ( queries )
1.
1.
Hierarchical
Network
Entity relationship
Relational
Object oriented
The evolution of Data Models
Hierarchical Model
CLOTHES
MEN WOMEN
One-to-many relationship:
Parent-Child Relationship
Deletion Problem:
Pointers
Complexity
Parent mode deleted automatically child node will be deleted
The evolution of Data Models
Network Model
Network model is an extension of hierarchical model.
This model was recommended as the best before relationship model.
Same like hierarchical model, the only difference between these two models
are a record can have more than one parent
For Example consider the following diagram a student entity has more than
one parent
COLLEGE
DEPARTMENT LIBRARY
STUDENT
The evolution of Data Models
More paths
1. Entities
2. Attributes
3. Relationships
The evolution of Data Models
Example for ER Diagram ( Faculty and Department entity set)
Dept_ID
Faculty_Id Faculty_Name
Phone_
No
Salary Dept_Locatio
Dept_Nam n
e
Date_of_
Birth
The evolution of Data Models
Features of ER Model
Graphical representation
Visualization
Good Database design (Widely used)
Advantages of ER Model
Very Simple
Better communication
Easy to convert to any model
Disadvantage of ER Model
No industry standard
Hidden information
The evolution of Data Models
Relational Model
Widely used model
Data are represented as row-wise and column-wise ( 2 Dimensional Array)
Example : EMP (Employee) Table
The evolution of Data Models
Relational Model
Records
Attributes
Simple
Scalable
Structured format
Isolation
Hardware overheads
The evolution of Data Models
Object Oriented Model
Reference : https://databasemanagement.fandom.com/wiki/Degrees_of_Abstraction
Degrees of Data Abstraction
The External Model is the end users' view of the data. The end users view of data
usually applies to their specific business needs and those of their
organizational
unit.
The Conceptual Model is the database as seen by the specific DBMS. What sets
the internal model apart from the external and conceptual is its reliance on its
software platform.
The goal in designing the internal model is to achieve logical independence, where
the
internal model can be changed without affecting conceptual model.
Reference : https://databasemanagement.fandom.com/wiki/Degrees_of_Abstraction
Degrees of Data Abstraction
The Physical Model is the final and lowest level of abstraction. This is the
model which describe such implementation level design as how the data is
stored on media and what media to use. This level of abstraction is reliant on
software and hardware.
Note:
Reference : https://databasemanagement.fandom.com/wiki/Degrees_of_Abstraction
Database Users and DBA
Database Users
Naive Users
Application Programmers
Sophisticated Users
Native Users
Specialized Users
Stand-alone Users
Database Users and DBA
Naive Users
Those who don’t have any knowledge about DBMS
Use DBMS applications frequently
Mostly using the internet browser as an interface to access the database
They don’t have any privileges to modify the database, simply use the application
Example : Railway booking users, Clerks in bank accessing database
Application Programmers
Users who develop DBMS applications.
They are backend programmers
Programs can be written in any programming languages like C++, JAVA, Python, PHP
Database Users and DBA
Sophisticated Users
Having knowledge about database and DBMS
They can create their own applications based on requirements
They don’t write codes in any programming languages, but able to manage using
queries
Example : Business Analyst, Researchers
Native Users
These are the users, who use the existing database applications
They don’t write any codes or queries
Example: Library Management Systems, Inventory Control Systems
Database Users and DBA
Specialized Users
These are also sophisticated users, but they write special database application
programs.
They are the developers who develop the complex programs to the
requirement.
Stand-alone Users
These users will have a stand-alone database for their personal use.
These kinds of the database will have readymade database packages
which will have menus and graphical interfaces.
Database Users and DBA
Database Administrator ( DBA)
DBA is a person or a group who define and manage the database in all three levels.
DBA can create / modify /remove the users based on the requirements.
DBA is the super user having all the privileges of DBMS
Responsibilities of DBA
Install the Database
Upgrade the Database
Design and Implementation
Database tuning
Migrating the Database
User Management
Backup and Recovery
Security of the Database in all access points
Documentation
Design process
The Entity-Relationship (E-R) Model
Entity : Any object in the real world is an entity
The ER data model uses a collection of entities (objects) and relationships among these
entities
Note : The attributes dept_id, faculty_id used to identify an entity in an entity set. Like
AADHAR CARD number for a person . ( Will be discussed later in detail )
Design process
Relationship :
One of the most popular model is to use UML ( Unified Modeling Language)
Design process
Membe
r
Normalization
Entity Sets
An entity set is a set of entities of the same type that shares the
same attributes.
The set of people who are faculties at a given university, can be
defined as entity set “faculty”
Similarly the entity set “student” represent all the students in
the university.
The entity sets do not need to be disjoint.
For example we can create an entity set called “person” can
have faculty entity , student entity, both or neither.
Entity Relationship Model
Attributes
Attributes are descriptive properties possessed by each member of an entity
set.
Each entity must have its own value for each attribute.
For instance , the particular faculty entity may have the following values :
faculty_id = 100186
faculty_name = ‘Nantha’
faculty_ dept = ‘Computing Technologies’
faculty_salary = 123456
faculty_mobile = 9999955555
The faculty_id attribute is used to identity the faculty uniquely , because there is a
possibility for more number of faculties will have the same name
In general the university use to assign unique id for faculty and students (Reg. No)
Entity Relationship Model
To explain this, the individual faculty entity Nantha, who has faculty_id
100186, and the student entity Abhinav ranjan who has student_regno
RA1911003010003 participate in a relationship instance counselor.
Consider a relationship set “counselor” with entity sets Faculty and Student.
The attribute date can be associate with that relationship to specify the date
when the faculty became the counselor of a student.
02 Jan
2002
03 Jan
2022
….
….
….
….
….
….
….
10 Jan
2022
Entity Relationship Model
Binary relationship set
One entity set involves in two entity sets is known as Binary relationship set.
Example
The faculty and student entity sets participate in relationship set counselor.
In addition each student must have another faculty who works as department
counselor ( Co-ordinator )
Then the faculty and student entity sets may participate in another
relationship set, dept counselor.
Entity Relationship Model
Attributes
For each attribute, there is a set of permitted values, called the domain, or value set, of that
attribute.
For example the domain attribute of student_regno might be the set of all text strings of a
certain length.
Similarly the domain attribute of dept_name might be strings from the set
{ CSE,IT, MECH,ECE, EEE, BT,….}
An attribute of an entity set is a function that maps from the entity set into a domain.
An entity set may have several attributes, Each entity is described by a set of ( Attribute,
Data Value) Pairs.
Constraints
An E-R enterprise schema may define certain constraints to
which the contents of a database must conform.
Mapping Cardinalities
Mapping cardinalities, or cardinality ratios, express the number of entities to which
another entity can be associated via a relationship set.
For a binary relationship set “Assign” between entity sets Programmer and Project
the mapping cardinality must be one of the following.
One-to-One (1:1)
One-to-Many (1:M)
Many-to-One (M:1)
Many-to-Many (M:M)
Entity Relationship Model
Mapping Cardinalities
One-to-One (1:1)
An entity in Programmer is associated with at most one entity in Project, and
an entity in Project is associated with at most one entity in Programmer.
The following figure depicts 1:1 mapping cardinality
Programmer Entity Project Entity Set
Set
Programme Relationship
r1 Set Project
“Assign” 1
Programme
r2 Project
2
Programmer
3 Project
3
Programmer
4
Entity Relationship Model
Mapping Cardinalities
One-to-Many (1:M)
One-to-many. An entity in Programmer is associated with any number (zero or
more) of entities in Project. An entity in Project, however, can be associated
with at most one entity in Programmer.
The following figure depicts mapping
Programmer Entitycardinality 1:MEntity Set
Project
Set
Project
Relationship 1
Programme Set “Assign”
r1 Project
2
Programme
r2 Project
3
Programmer Project
3 4
Project
5
Entity Relationship Model
Mapping Cardinalities
Many-to-One (M:1)
An entity in Programmer is associated with at most one entity in Project. An
entity in Project, however, can be associated with any number (zero or more)
of entities in Programmer.
The following figure depicts mapping
Programmer Entitycardinality 1:MEntity Set
Project
Set
Relationshi
Programme
p Set
r1 Project
“Assign”
Programme 1
r2
Project
Programmer 2
3
Programmer Project
4 3
Programmer
4
Entity Relationship Model
Mapping Cardinalities
Many-to-Many (M:M)
An entity in Programmer is associated with any number (zero or more) of
entities in Project, and an entity in Project is associated with any number
(zero or more) of entities in Programmer.
The following figure depicts mapping
Programmer Entitycardinality M:M
Project Entity Set
Set
Relationship
Programme Set “Assign” Project
r1 1
Programme Project
r2 2
Programmer Project
3 3
Programmer Project
4 4
Entity Relationship Model
Participation Constraints
Total Participation :
The participation of an entity set E in a relationship set R is said to be
total if every entity in E participates in at least one relationship in R.
Partial Participation :
If only some entities in E participate in relationships in R, the participation
of entity set E in relationship R is said to be partial.
Programmer Entity Project Entity Set
Set
Programme Relationship
r1 Set Project
“Assign” 1
Programme
r2 Project
2
Programmer
3 Project
3
Programmer
4
Entity Relationship Model
Participation Constraints
Example :
In Figure : A, the participation of Project Entity Set in the relationship set is total while
the participation of A in the relationship set is partial.
In Figure : B, the participation of both Programmer Entity Set and Project Entity Set in
the relationship set are total.
Counselor
ER diagram
If a relationship set has some attributes associated with it, then we enclose the
attributes in a rectangle and link the rectangle with a dashed line to the diamond
representing that relationship set.
For example, in the given figure, the date descriptive attribute attached to the
relationship set counselor to specify the date on which the faculty became the
counselor.
DATE
Counselor
ER diagram
Mapping Cardinality
The relationship set counselor, between the faculty and student entity sets
may be one-to-one, one-to-many, many-to-one, or many-to-many.
To distinguish among these types, we draw either a directed line ( → ) or an
undirected line ( — ) between the relationship set and the entity.
m-
One-to-one: m
Line from the relationship set counselor to both entity sets faculty and
student as given in the figure below. This indicates that a faculty may
counsel at most one student, and a student may have at most one
counselor.
Counselor
If both arrow
o- o
ER diagram
Mapping Cardinality
One-to-many:
A directed line from the relationship set counselor to the entity set
faculty and an undirected line to the entity set student as shown in the
below figure, indicates that a faculty may counsel many students, but a
student may have at most one counselor.
Counselor
ER diagram
Mapping Cardinality
Many-to-one:
An undirected line from the relationship set counselor to the entity set
faculty and a directed line to the entity set student as shown in the below
figure, indicates that a faculty may counsel at most one student, but a
student may have many counselors.
Counselor
ER diagram
Mapping Cardinality
Many-to-many:
We draw an undirected line from the relationship set counselor to both entity
sets faculty and student as shown in the below figure, indicates that a faculty
may counsel many students, and a student may have many counselor.
Counselor
ER diagram
Complex Attributes
Figure shows how composite attributes can be represented
in the E-R notation.
Here, a composite attribute Faculty_name, with
component attributes Faculty_first_name,
Faculty_middle_name, and Faculty_last_name replaces the
simple attribute name of Faculty.
As another example, An address to the Faculty entity-set.
The address can be defined as the composite attribute
Faculty_address with the attributes street, city, state, and
pincode.
The attribute street is itself a composite attribute whose
component attributes are Faculty_street_no and
Faculty_street name.
The given figure also illustrates a multivalued attribute
phone number, denoted by “{ Faculty_phone_no }”.
A derived attribute age, depicted by a “Faculty_age ( )”.
Keys , Attributes and Constraints
Keys
An entity should be identified in an entity set uniquely.
Superkey
A superkey is a set of one or more attributes that, taken
collectively, allow us to identify uniquely a record in the relation.
For example, the Faculty_ID attribute of the relation faculty is
sufficient to distinguish one faculty record from another.
Superkey
The Primary key should be selected with special care.
As we discussed the name of the person is obviously not
sufficient to identify uniquely a person , because many persons
can have the same name.
In India , now the Aadhar card number attribute would be a
primary key / candidate key.
Non resident of India will not have the Aadhar number .
An alternative is to use some unique combination of other
attributes as a key.
Keys , Attributes and Constraints
Superkey
The primary key should be chosen such that its attribute values are never,or very
rarely, changed.
For example , the address field should not be a primary key or part of primary
key, since it is likely to change but, Aadhar number guaranteed never to change.
To represent the primary key , the primary key attributes are underlined
A relation, say r1, may include among its attributes the primary key of an other
relation, say r2. This attribute is called a foreign key from r1, referencing r2.
The relation r1 is also called the referencing relation of the foreign key
dependency, and r2 is called the referenced relation of the foreign key.
Note : A primary key for a particular relation/ table is act as an referential key in
another table (s) is called foreign key , it known as referential integrity
constraints
Keys , Attributes and Constraints
Superkey
Consider the two entitiy sets named : Faculty and Department
For Faculty entity set the primary key is : Faculty_id
For Department entity set the primary key is : Dept_id
In this relations, Dept_id in the Department relation , is the referential key or
foreign key for the Faculty relation.
Primary key in a relations is underlined
Only one primary key is possible for a relation
One or more attributes can be combined and declared as a primary key , known as
composite primary key. ( Note : Maximum 16 Columns are allowed )
Keys , Attributes and Constraints
Attributes
Simple attributes
It can not be divided further
All the simple attributes will hold the atomic values
Example :
Student = { Register_no, Name, ………. }
Age
Register_no
STUDENT
Branch
Keys , Attributes and Constraints
Composite attributes
Composed by many other simple attributes
Example : Address , Name , etc.,
First Name
Middle Name
Door No Street
STUDENT Name
Address
City
Pincode
Last Name
Keys , Attributes and Constraints
STUDENT
REG_NO DOB
Keys , Attributes and Constraints
STUDENT
PHONE_NO EMAIL_ID
Keys , Attributes and Constraints
Derived attributes
A value which is derived from already existing value.
It is not advisable to store such kind of values in database.
The derived attributes represented by ellipse using dotted lines
Example : Age , Gross Salary
In the given figure below, Age is derived from DOB and Gross
Salary derived from Basic Pay
BASIC PAY
DOB
STUDENT
GROSS
AGE SALARY
Keys , Attributes and Constraints
Key attributes
Attributes which is used to identify an entity in an entity set is called
Key attributes
Key attributes are represented by underline the name of the attribute.
In the given figure , In Student entity the attribute Register_no is key
attribute used to identity each student uniquely.
Age
Register_no
STUDENT
Branch
Keys , Attributes and Constraints
Constraints
It is a condition to manage the consistency as well integrity of
the values stored in an attribute.
Constraints specified at the time of designing relations is good
choice
There are two types of Constraints
Domain Constraints
Not Null
Check
Unique
Primary key
Integrity Constraints
Referential key or Foreign key
Keys , Attributes and Constraints
Domain Constraints
Not Null :
( NOTE : By default ,an attribute hold NULL values )
If an attribute holds not null constraint
The value should be inserted
It will not accept “NULL” values
It will accept Duplicate values
N number of not null constraints is possible in a relation
While inserting a new record the not null must be entered otherwise , insertion of new
record is not possible
Example : Student entity defined with not null constraint for an attribute Register_no
CREATE TABLE STUDENT ( Register_no Note : An attribute can hold one or more
Number(10) Unique, LastName
varchar(25) , FirstName varchar(25), constraints
DOB Date ); CREATE TABLE STUDENT ( Register_no Number(10) Not null Unique,
LastName varchar(25),FirstName varchar(25), DOB Date );
Keys , Attributes and Constraints
Domain Constraints
Primary key
Minimal of super key is known as Candidate key.
Candidate key represented as PRIMARY KEY
A relation can have only one primary key
Combination of one or more ( Maximum 16 Nos ) attributes can be declared as primary
key.
It will not accept both null values and duplicate values.
Primary key is the combination of Not null and Unique constraints.
Primary key can act as a referential key for another table called child table.
Example: A Student entity created with primary key constraint for an attribute
Register_no
Note : The geiven emp entity , primary key attribute is empno and foreign
key is
dept_id which is the primary key in dept entity.
Keys , Attributes and Constraints
An overview of Constraints
Mapping Cardinality
Mapping Cardinalities
Mapping cardinalities, or cardinality ratios, express the number of entities to which
another entity can be associated via a relationship set.
For a binary relationship set “Assign” between entity sets Programmer and Project
the mapping cardinality must be one of the following.
One-to-One (1:1)
One-to-Many (1:M)
Many-to-One (M:1)
Many-to-Many (M:M)
Extended ER - Generalization, Specialization
and Aggregation
Extended ER Features
Basic ER Model is more than enough to model most of the Database
Features.
Extended ER model developed for some aspects of Database features
more suitably expressed
The followings are the Extended ER Features
Specialization
Generalization
Higher and lower level entity sets
Attribute inheritance
Aggregation
To explain the above concepts, slightly more elaborate the schema for
the university, by considering an entity set “person” with attributes “id”,
“name”, and “address”
Extended ER - Generalization, Specialization
and Aggregation
Specialization
An entity set may include subgroupings of entities that are distinct in some way from
other entities in the set.
a subset of entities within an entity set may have attributes that are not shared by all
the entities in the entity set.
The E-R model provides a means for representing these distinctive entity groupings.
The Entity set person may be further classified as one of the following:
Employee
Student
Extended ER - Generalization, Specialization
and Aggregation
Specialization
Both employee and student is described by a set of attributes that
includes all the attributes of entity set person plus possibly additional
attributes.
For example, employee entities may be described further by the
attribute salary, whereas student entities may be described further by
the attribute fees.
The process of designating subgroupings within an entity set is called
specialization.
The specialization of person allows us to distinguish among person
entities according to whether they correspond to employees or
students:
In general, a person could be an employee, a student, both, or neither.
Extended ER - Generalization, Specialization
and Aggregation
Specialization
As another example, suppose the university divides students into
two categories: Under graduate and Post graduate.
Under graduate students have an office assigned to them. Post
graduate students are assigned to a residential college.
Each of these student types is described by a set of attributes that
includes all the attributes of the entity set student plus additional
attributes.
The university could create two specializations of student, namely
under graduate and post graduate.
Extended ER - Generalization, Specialization
and Aggregation
Specialization
We can apply specialization repeatedly to refine a design.
For instance, university employees may be further classified as one
of the following:
Faculty
Secretary
Each of these employee types is described by a set of attributes that
includes all the attributes of entity set employee plus additional
attributes.
For example, faculties entities may be described further by the
attribute designation while secretary entities are described by the
attribute hours per week.
Further, secretary entities may participate in a relationship secretary
for between the secretary and employee entity sets, which identifies
the employees who are assisted by a secretary.
Extended ER - Generalization, Specialization
and Aggregation
Specialization
An entity set may be specialized by more than one
distinguishing feature.
In our example, the distinguishing feature among employee
entities is the job the employee performs.
Another, coexistent, specialization could be based on whether
the person is a temporary employee or a permanent employee?
Resulting in the entity sets temporary employee and permanent
employee.
Extended ER - Generalization, Specialization
and Aggregation
Specialization
In terms of an E-R diagram, specialization
is depicted by a hollow arrow-head
pointing from the specialized entity to the
other entity
We refer to this relationship as the ISA
relationship, which stands for “is a” and
represents, for example, that an faculty
“is a” employee.
Extended ER - Generalization, Specialization
and Aggregation
Specialization
Specialization represents in an E-R diagram depends on whether an
entity may belong to multiple specialized entity sets or if it must
belong to at most one specialized entity set.
Multiple sets permitted is called overlapping specialization
At most one permitted is called disjoint specialization.
For an overlapping specialization (refer the figure in slide number 87
for student and employee as specializations of person), two
separate arrows are used.
For a disjoint specialization (refer the figure in slide number 87 for
faculty and secretary as specializations of employee), a single arrow
is used.
The specialization relationship may also be referred to as a
superclass-subclass relationship.
Extended ER - Generalization, Specialization
and Aggregation
Generalization
The refinement from an initial entity set into successive levels of
entity subgroupings represents a top-down design process in which
distinctions are made explicit.
The design process may also proceed in a bottom-up manner, in
which multiple entity sets are synthesized into a higher-level entity
set on the basis of common features.
The database designer may have first identified:
Faculty entity set with attributes Faculty_id, Faculty_name,
Faculty_salary, and Faculty_Desig.
Secretary entity set with attributes secretary_id,
secretary_name, secretary_salary, and hours_per_week.
Extended ER - Generalization, Specialization
and Aggregation
Generalization
There are some similarities are between the Faculty entity and
Secretary entity, means several attributes that are conceptually
the same across the two entity sets.
For example, the identifier, name, and salary attributes are
common between Faculty and Secretary entities.
This commonality can be expressed by Generalization.
Generalization is a containment relationship that exists between a
higher-level entity set and one or more lower-level entity sets.
In given example (slide number 85) ,employee is the higher-level
entity set and faculty and secretary are lower-level entity sets.
Higher- and lower-level entity sets also may be designated by the
terms superclass and subclass, respectively.
The person entity set is the superclass of the employee and
student subclasses.
Extended ER - Generalization, Specialization
and Aggregation
Attribute Inheritance
An important property of the higher- and lower-level entities created by
specialization and generalization is attribute inheritance.
The attributes of the higher-level entity sets are said to be inherited by
the lower-level entity sets.
Example, student and employee inherit the attributes of person.
Student entity is described by its ID, name, and address attributes, and
additionally a fees attribute.
Employee is described by its ID, name, and address attributes, and
additionally a salary attribute.
Attribute inheritance applies through all tiers of lower-level entity sets.
Example : Faculty and Secretary, which are subclasses of employee,
inherit the attributes ID, name, and address from person, in addition
to inheriting the attribute salary from employee.
Extended ER - Generalization, Specialization
and Aggregation
Attribute Inheritance
An E-R model was arrived at by specialization or generalization,
the outcome is basically the same:
A higher-level entity set with attributes and relationships that
apply to all of its lower-level entity sets.
Lower-level entity sets with distinctive features that apply
only within a particular lower-level entity set.
Extended ER - Generalization, Specialization
and Aggregation
Attribute Inheritance
The given Figure describes a hierarchy of entity
sets.
In the figure, employee is a lower-level entity set of
person and a higher-level entity set of the faculty
and secretary entity sets.
In a hierarchy, a given entity set may be involved
as a lower- level entity set in only one ISA
relationship; that is, entity sets in this diagram
have only single inheritance.
If an entity set is a lower-level entity set in more
than one ISA relationship, then the entity set has
multiple inheritance, and the resulting structure is
said to be a lattice.
Extended ER - Generalization, Specialization
and Aggregation
Aggregation
One limitation of the E-R
model is that it cannot
express relationships
among relationships.
To illustrate the need for
such a construct, consider
the ternary relationship PROJECT
Aggregation
Using the basic E-R
modeling constructs, the
following E-R diagram for
the above constraints is
obtained PROJEC
T
_GUIDE
The notions of an entity set and a relationship set are not precise.
B C
R
ER Diagram Issues
B E C
R R
ER Diagram Issues
12-01-2024
ER Diagram Issues
The relational model is today the primary data model for commercial
data processing applications.
It attained its primary position because of its simplicity, which eases
the job of the programmer / developer.
It is simple and easy to understand compared to earlier data models
such as the network model or the hierarchical model.
The followings should be consider for Relational Model
Structure of Relational Databases
Database Schema
Keys
Schema Diagrams
Relational Query Languages
Relational Operations
Relational Model
Database Schema
Database Schema
Consider the Department relation
Database Schema
Consider the university database example ( Slide Number : 96)
Each course in a university may be offered multiple times,
across different semesters, or even within a semester.
A relation to describe each individual offering, or section, of the
class.
The schema is:
section (course_code, sec id, semester, year, location,
room number, time slot id)
To describe the association between faculty and the class
sections that they teach.
teaches (faculty_id, course id, sec id, semester, year)
Relational Model
Database Schema
Section relation
Relational Model
Database Schema
Teaches Relation
Relational Model
Database Schema
Keys
One or more attributes used to identify an entity uniquely in an
entity set if known as key attributes .