Professional Documents
Culture Documents
DBMS Unit-1
DBMS Unit-1
UNIT-1
The Entity Relationship Model: Database Design And ER Diagrams, Entities, Attributes, And
Entity Sets, Relationships And Relationships Sets, Additional Features Of The ER Model,
Conceptual Design With The ER Model , Conceptual Design For Large Enterprises.
Or
• MYSQL
• SQL SERVER
• ORACLE
What is DBMS?
Database Management System (DBMS) is a software for storing and retrieving
users’ data while considering appropriate security measures. It consists of a group
of programs which manipulate the database.
DBMS allows users to create their own databases as per their requirement. The term
“DBMS” includes the user of the database and other application programs. It
provides an interface between the data and the software application.
1
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Characteristics of DBMS
Here are the characteristics and properties of Database Management System:
• Provides security and removes redundancy
• Self-describing nature of a database system
• Insulation between programs and data abstraction
• Support of multiple views of the data
• Sharing of data and multiuser transaction processing
• Database Management Software allows entities and relations among them
to formtables.
• It follows the ACID concept (Atomicity, Consistency, Isolation, and Durability).
• DBMS supports multi-user environment that allows users to access and
manipulate data in parallel.
• Advantages of DBMS
• DBMS offers a variety of techniques to store & retrieve data
• DBMS serves as an efficient handler to balance the needs of multiple
applications using the same data
• Uniform administration procedures for data
• Application programmers never exposed to details of data representation
and storage.
• A DBMS uses various powerful functions to store and retrieve data efficiently.
• Offers Data Integrity and Security
• The DBMS implies integrity constraints to get a high level of protection
against prohibited access to data.
• A DBMS schedules concurrent access to the data in such a manner that
only one user can access the same data at a time
• Reduced Application Development Time
DBMS Concepts
DBMS solutions come equipped with a unique set of components, each responsible for
performing different tasks. Here are the most basic DBMS components:
2
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
❖ Database System Applications: The Databases are widely used in many areas and
many applications. Here are some of the Database Applications.
❖
❖ Enterprise Information:
Sales: For customer, product, and purchase information.
Accounting: For payments, receipts, account balances, assets and other accounting
information.
resources Human: For information about employees, salaries, payroll taxes and
benefits, and for generation of paychecks.
Manufacturing: For management of supply chain and for tracking production of
items in factories, inventories of items in warehouses/stores, and orders for items.
Online retailers: For sales data noted above plus online order tracking, generation
of recommendation lists, and maintenance of online product evaluation.
Banking and Finance:
Banking: For customer information, accounts, and loans, and banking transactions.
Credit card transactions: For purchases on credit cards and generation of monthly
statements.
3
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Finance: For storing information about holdings, sales, and purchases of financial
instruments such as stocks and bonds.
Universities: For student information, course registrations, and grades.
Airlines: For reservations and schedule information. Airlines were among the first to
use databases in a geographically distributed manner—terminals situated around the
world accessed the central database system through phone lines and other data
networks.
Telecommunication: For keeping records of calls made, generating monthly bills,
maintaining balances on prepaid calling cards, and storing information about the
communication networks.
Railway Reservation Systems: For reservations and schedule information.
Library Management System − Now-a-days it’s become easy in the Library to
track each book and maintain it because of the database. This happens because there
are thousands of books in the library. It is very difficult to keep a record of all books
in a copy or register. Now DBMS used to maintain all the information related to book
issue dates, name of the book, author and availability of the book.
Social Media Sites : By filling the required details we are able to access social
media platforms. Many users sign up daily on social websites such as Facebook,
and Instagram. All the information related to the users are stored and maintained with
the help of DBMS.
File system is a collection of data. In this DBMS is a collection of data. In DBMS, the
system, the user has to write the procedures user is not required to write the procedures.
for managing the database
.
File system provides the detail of the data DBMS gives an abstract view of data that
representation and storage of data hides the details.
.
File system doesn't have a crash mechanism, DBMS provides a crash recovery
i.e., if the system crashes while entering mechanism, i.e., DBMS protects the user
some data, then the content of the file will from the system failure.
lost.
It is very difficult to protect a file under the DBMS provides a good protection
file system. mechanism.
File system can't efficiently store and retrieve DBMS contains a wide variety of
the data sophisticated techniques to store and retrieve
the data.
In the File system, concurrent access has DBMS takes care of Concurrent access of
many problems like redirecting the file while data using some form of locking.
other deleting some information or updating
some information.
4
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
VIEW OF DATA:
A database system is a collection of interrelated files and a set of programs that allow
users to access and modify these files. A major purpose of database system is to provide users
with an “Abstract View” of the data. That is, the system hides certain details of how data
stored and maintained.
Or
View of data in DBMS narrate how the data is visualized at each level of data abstraction.
Data abstraction allow developers to keep complex data structures away from the users. The
developers achieve this by hiding the complex data structures through levels of abstraction.
There is one more feature that should be kept in mind i.e. the data independence. While
changing the data schema at one level of the database must not modify the data schema at the
next level. In this section, we will discuss the view of data in DBMS with data abstraction,
data independence, data schema in detail.
1. Data Abstraction
2. Data Independence
4. Key Takeaways
1. Data Abstraction
Data abstraction is hiding the complex data structure in order to simplify the
user’s interface of the system. It is done because many of the users interacting with
the database system are not that much computer trained to understand the complex
data structures of the database system.
To achieve data abstraction, we will discuss a Three-Schema architecture which
abstracts the database at three levels discussed below:
5
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
1.Physical Level/ Internal Level: The physical or the internal level schema describes how
the data is stored in the hardware. It also describes how the data can be accessed. The
physical level shows the data abstraction at the lowest level and it has complex data
structures. Only the database administrator operates at this level.
2. Logical Level/ Conceptual Level: It is a level above the physical level. Here, the data is
stored in the form of the entity set, entities, their data types, the relationship among the
entity sets, user operations performed to retrieve or modify the data and certain constraints
on the data. Well adding constraints to the view of data adds the security. As users are
restricted to access some particular parts of the database. It is the developer and database
administrator who operates at the logical or the conceptual level.
iii. View Level/ User level/ External level: It is the highest level of data abstraction and
exhibits only a part of the whole database. It exhibits the data in which the user is interested.
The view level can describe many views of the same data. Here, the user retrieves the
information using different application from the database.
What is an instance?
The data stored in database at a particular moment of time is called instance of database.
Database schema defines the variable declarations in tables that belong to a particular
database; the value of these variables at a moment of time is called the instance of that
database.
What is Schema:
Schema is a structural view of a database. Moreover, a schema diagram refers to
representing a database as a diagram. It represents the relationship between the
tables. However, it does not show the data present in the tables.
6
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
For example: In the following diagram, we have a schema that shows the relationship
between three tables: Course, Student and Section. The diagram only shows the design of
the database, it doesn’t show the data present in those tables. Schema is only a structural
view(design) of a database
❖ Data Models
Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data. It provides the conceptual tools for describing the design of a database
at each level of data abstraction. Therefore, there are following four data models used for
understanding the structure of the database:
Relational Model:
1. Relational Data Model: This type of model designs the data in the form of rows and
columns within a table. Thus, a relational model uses tables for representing data and
in-between relationships. Tables are also called relations. This model was initially
described by Edgar F. Codd, in 1969. The relational data model is the widely used
model which is primarily used by commercial data processing applications.
7
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
2. Semistructured Data Model: This type of data model is different from the other three
data models (explained above). The semistructured data model allows the data specifications
at places where the individual data items of the same type may have different attributes sets.
The Extensible Markup Language, also known as XML, is widely used for representing the
semistructured data. Although XML was initially designed for including the markup
information to the text document, it gains importance because of its application in the
exchange of data.
ER MODEL BENEFITS
DATABASE LANGUAGES
A DBMS has appropriate languages and interfaces to express database queries and updates.
Database languages can be used to read, store and update the data in the database.
DDL stands for Data Definition Language. It is used to define database structure or pattern.
It is used to create schema, tables, indexes, constraints, etc. in the database.
Using the DDL statements, you can create the skeleton of the database.
Data definition language is used to store the information of metadata like the number of
tables and schemas, their names, indexes, columns in each table, constraints, etc.
These commands are used to update the database schema that's why they come under Data
definition language.
DML stands for Data Manipulation Language. It is used for accessing and manipulating data
in a database. It handles user requests.
Here are some tasks that come under DML:
9
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
• DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
• The DCL execution is transactional. It also has rollback parameters. (But in Oracle
database, the execution of data control language does not have the feature of rolling back.)
There are the following operations which have the authorization of Revoke:
CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.
TCL is used to run the changes made by the DML statement. TCL can be grouped into a
logical transaction.
Here are some tasks that come under TCL:
• Commit: It is used to save the transaction on the database.
• Rollback: It is used to restore the database to original since the last Commit.
i. Centralized.
ii. Client-server.
iii. Parallel (multi-processor).
iv. Distributed
10
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
The storage manager is important because databases typically require a large amount
of storage space. Some Big organizations Database ranges from giga bytes to tera bytes. So
the main memory of computers cannot store this much information, the information is stored
on disks. Data are moved between disk storage and main memory as needed.
The query processor also very important because it helps the database systems simplify and
facilitate access to data. So quick processing of updates and queries is important. It is the job
of the database system to translate updates and queries written in a nonprocedural language,
at the logical level, into an efficient sequence of operations at the physical level.
A primary goal of a database system is to retrieve information from and store new
information in the database. People who work with a database can be categorized as database
users or database administrators.
11
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Database Users:
There are four different types of database-system users, differentiated by the way they expect
to interact with the system.
Naive users:
These users are also called as Unsophisticated Users. They don’t have any type of knowledge
with the system. These users interact with the system by invoking one of the application
programs that have been written previously.
For example, a bank teller who needs to transfer $50 from account A to account B
invokes a program called transfer. This program asks the teller for the amount of
money to be transferred, the account from which the money is to be transferred, and
the account to which the money is to be transferred.
Application programmers:
These users are computer professionals who write application programs. Application
programmers can choose from many tools to develop user interfaces. Rapid application
development (RAD) tools are tools that enable an application programmer to construct forms
and reports without writing a program.
Sophisticated users:
These users are interacting with the system without writing programs. Instead, they
form their requests in a database query language. They submit each such query to a query
processor, whose function is to break down DML statements into instructions that the storage
manager understands. Analysts who submit queries to explore data in the database fall in this
category.
Specialized users:
These users are sophisticated users who write specialized database applications that
do not fit into the traditional data-processing framework. Among these applications are
computer-aided design systems, knowledge base and expert systems, systems that store data
with complex data types (for example, graphics data and audio data), and environment Unit
modeling systems.
Database Administrator:
Coordinates all the activities of the database system. The database administrator has a good
understanding of the enterprise’s information resources and needs.
• Database administrator's duties include:
Schema definition: The DBA creates the original database schema by executing a
set of data definition statements in the DDL.
Storage structure and access method definition.
Schema and physical organization modification: The DBA carries out changes to
the schema and physical organization to reflect the changing needs of the
organization, or to alter the physical organization to improve performance.
Granting user authority to access the database: By granting different types of
authorization, the database administrator can regulate which parts of the database
various users can access.
Specifying integrity constraints.
Monitoring performance and responding to changes in requirements.
Query Processor:
The query processor will accept query from user and solves it by accessing the database.
This will interprets DDL statements and fetch the definitions in the data dictionary.
• DML compiler
a. This will translates DML statements in a query language into low level instructions that the
query evaluation engine understands.
b. A query can usually be translated into any of a number of alternative evaluation plans for
same query result DML compiler will select best plan for query optimization.
• Query evaluation engine
This engine will execute low-level instructions generated by the DML compiler on DBMS.
13
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
3. Logical Database Design: In this step convert the conceptual database design into a
database schema (Logical Database Design) in the data model of the chosen DBMS. In terms
of relational DBMSs, and therefore, the task in the logical design step is to convert an ER
schema into a relational database schema. The result is a conceptual schema, sometimes
called the logical schema, in the relational data model.
BEYOND THE ER DESIGN: The first three steps are more relevant to the ER Model. Once
the logical scheme is defined designer consider the physical level implementation and finally
provide certain security measures. The remaining three steps of database design are briefly
described below:
14
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
4. Schema Refinement: The fourth step in database design is to analyze the collection of
relations in our relational database schema to identify potential problems, and to refine it. In
contrast to the requirements analysis and conceptual design steps, which are essentially
subjective, schema refinement can be guided by some elegant and powerful theory.
5. Physical Database Design: In this step, must consider typical expected workloads that our
database must support and further refine the database design to ensure that it meets desired
performance criteria. This step may simply involve building indexes on some tables and
clustering some tables, or it may involve a substantial redesign of parts of the database
schema obtained from the earlier design steps.
6. Security Design: The last step of database design is to include security features. This is
required to avoid unauthorized access to database practice after all the six steps. We required
Tuning step in which all the steps are interleaved and repeated until the design is satisfactory.
History of ER models
ER diagrams are visual tools that are helpful to represent the ER model.
Peter Chen proposed ER Diagram in 1971 to create a uniform convention that can
be used for relational databases and networks. He aimed to use an ER model as a
conceptual modelling approach.
❖ E-R diagrams are used to model real-world objects like a person, a car, a company
etc. and the relation between these real-world objects.
ER Diagram stands for Entity Relationship Diagram, also known as ERD is a diagram that
displays the relationship of entity sets stored in a database. In other words, ER diagrams help
to explain the logical structure of databases. ER diagrams are created based on three basic
concepts: entities, attributes and relationships.
ER Diagrams contain different symbols that use rectangles to represent entities, ovals to
define attributes and diamond shapes to represent relationships.
At first look, an ER diagram looks very similar to the flowchart. However, ER Diagram
includes many specialized symbols, and its meanings make this model unique. The purpose
of ER Diagram is to represent the entity framework infrastructure.
Here are the geometric shapes and their meaning in an E-R Diagram
15
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
ENTITY:
An entity is a thing which is distinguishable from other objects. Entities are represented by
using rectangular boxes. .
A real-world thing either living or non-living that is easily recognizable and
nonrecognizable. It is anything in the enterprise that is to be represented in our
database. It may be a physical thing or simply a fact about the enterprise or an
event that happens in the real world.
An entity can be place, person, object, event or a concept, which stores data
in the database. The characteristics of entities are must have an attribute, and a
unique key. Every entity is made up of some ‘attributes’ which represent that entity.
Examples of entities:
• Person: Employee, Student, Patient
• Place: Store, Building
• Object: Machine, product, and Car
• Event: Sale, Registration, Renewal
• Concept: Account, Course
Here student is a strong entity, as it has a primary key attribute ID which is uniquely defined
16
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
WEAK ENTITY: An entity whose existence depends on the existence of another entity is
called Weak entity. An entity set may not have sufficient attributes to form a primary key
such an entity set is termed as a weak entity set. Weak entity is represented by double
rectangular box.
Note – Weak entity always has total participation but Strong entity may not have total
participation.
For example – a bank account cannot be uniquely identified without knowing the bank to
which the account belongs, so bank account is a weak entity.
BANK-ACCOUNT BANK
Weak Entities : A weak entity is a type of entity which doesn't have its key attribute. It can
be identified uniquely by considering the primary key of another entity. For that, weak entity
sets need to have participation.
17
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
In the ER diagram the relationship between The relationship between one strong and a
two strong entity set shown by using a weak entity set shown by using the double
diamond symbol. diamond symbol.
The connecting line of the strong entity set The line connecting the weak entity set for
with the relationship is single. identifying relationship is double.
ATTRIBUTES:
Attributes are the properties of entities that are represented using ellipse-shaped figures.
Every elliptical figure represents one attribute and is directly connected to its entity (which is
represented as a rectangle). OR
Attribute: The property of the Entity is called an Attribute. The entity is described using a
set of Attributes. It is represented with oval.
1. Simple attribute.
2. Composite attribute.
5. Null attribute.
6. Key attribute.
7. Derived attribute.
8. Descriptive attribute.
Simple Attributes
class age
Roll-no
Student
As we can see in the above example, Student is an entity represented by a rectangle, and it consists
of attributes: Roll_no, class, and Age. Also, there is a point to be noted that we can't further
18
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
subdivide the Roll_no attribute and even the other two attributes into sub-attributes. Hence, they are
known as simple attributes of the Student entity.
Composite Attributes
Composite attributes have opposite functionality to that of simple attributes as we can further
subdivide composite attributes into different components or sub-parts that form simple attributes. In
simple terms, composite attributes are composed of one or more simple attributes.
The attributes that can be divided into subparts are known as composite attributes.
SINGLE VALUED ATTRIBUTE: The attribute have a single value for a particular entity
is known as single valued attribute. Eg: For instance, the student ID attribute for a specific
student entity refers to only one student ID. Such attributes are said to be single valued.
MULTI VALUED ATTRIBUTE: The attribute that have many values for a particular entity
is known as multi valued attribute. Eg: If we add to the instructor entity set an attribute
dependent name listing all the dependents. This attribute will be multi valued, since any
particular instructor may have zero, one or more dependents. To denote that an attribute is
multi valued, it represented by double oval shape
NULL ATTRIBUTE: A null attribute is an attribute that uses a null value when an entity
doesn’t have a value for an attribute. Null attribute is represented by empty oval shape
19
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
KEY ATTRIBUTE: A key is a minimal set of attributes whose values uniquely identify an
entity in the set. Eg: The entity set instructor includes the attributes ID, name, dept_name and
salary with ID forming the primary key. It can be represented by underlining the key
attribute.
For example, one may have no middle name. Null can also designate that an attribute value is
unknown. An unknown value may be either missing or not known.
DERIVED ATTRIBUTE: The values for this type of attribute can be derived from the
values of another related attribute. Derived attribute represented by dotted oval shape.
Here instructor is an entity where age indicates the instructor’s age. If it also has the attribute
date of birth we can calculate age from date of birth and current date.
Domain: The attribute with set of values is called Domain. For each attribute associated with
an entity set, must identify a domain of possible values. For example, if the company rates
employees on a scale of 1 to 10 and stores ratings in a field called rating, the associated
domain consists of integers 1 through 10.
20
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Key: A key is a minimal set of attributes whose values uniquely identify an entity in the set.
There could be more than one candidate key, and then select any of them as the Primary Key.
So for each entity set choose a key. The key attribute is represented with under line. Each
attribute in the primary key is underlined.
❖ Entity Set
An entity set in DBMS is a set that collectively represents a group of entities of a
similar type.
For example, an entity set of cars, an entity set of bank accounts, etc. In
DBMS, the whole table in the tabular representation of data is an entity set, while
each row inside this table is an entity. Below is the tabular representation, i.e., entity
set of bank accounts.
Below is the representation of the bank entity accounts set in an entity-relationship diagram.
21
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
22
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
The above Figure shows the relationship set Works_In, in which each relationship indicates a
department in which an employee works.
Descriptive Attributes: Descriptive attributes are used to record information about the
relationship. From above figure, since attribute is descriptive attribute which stores the
information about relationship.
Instance: An instance of a relationship set is a set of relationships. Below figure show that
each Employees entity is denoted by its ssn, and each Departments entity is denoted by it’s
did. The since value is shown beside each relationship.
Degree:
The number of entities associated with a relationship set is known by degree of entities.
1. Unary: Where the association is within a single entity.
2. Binary: A relationship that associates two entities is knows as binary relationship.
3. Ternary: When three entities are participating in the relation then that is a Ternary.
4. N – Ary. When more than three entities are participating in the relation then that is a N –
ary relation.
Consider another example of ER diagram, suppose that each department has offices in several
locations and to record the location at which each employee works. This relationship is
ternary because it must record an association between an employee, a department, and a
location as shown in bellow:
23
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Any association between two entity types is called a relationship. Entities take part in the
relationship. It is represented by a diamond shape. There are four types of relationships:
1. One to One
2. One to Many
3. Many to One
4. Many to Many
24
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Features of ER model: The basic E-R concepts can model most database features, some
aspects of a database may be more aptly expressed by certain extensions to the basic E-R
model. The extended E-R features are specialization, generalization, higher- and lower-
level entity sets, attribute inheritance, and aggregation.
The basic E-R concepts can model most database features, some aspects of a database
may be more aptly expressed by certain extensions to the basic E-R model.
1. Generalization
2. Specialization
3. Aggregation
Generalization –
Generalization is the process of extracting common properties from a set of
entities and create a generalized entity from it. It is a bottom-up approach.
For Example, STUDENT and FACULTY can be generalized to a higher-level
entity called PERSON as shown in Figure 1. In this case, common attributes like P_NAME,
P_ADD become part of higher entity (PERSON) and specialized attributes like S_FEE
become part of specialized entity (STUDENT).
25
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
Specialization –
In specialization, an entity is divided into sub-entities based on their characteristics.
It is a top-down approach where higher level entity is specialized into two or more lower
level entities.
For Example, EMPLOYEE entity in an employee management system can be
specialized into DEVELOPER, TESTER etc. In this case, common attributes
likeE_NAME, E_SAL etc. become part of higher entity (EMPLOYEE) and specialized
attributes like TES_TYPE become part of specialized entity (TESTER).
Aggregation –
Aggregation is an abstraction through which we can represent relationships as higher level
entity sets.
For Example, Employee working for a project may require some machinery. So, REQUIRE
relationship is needed between relationship WORKS_FOR and entity MACHINERY.
Using aggregation, WORKS_FOR relationship with its entities EMPLOYEE and
PROJECT is aggregated into single entity and relationship REQUIRE is created between
aggregated entity and MACHINERY.
26
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
ER model stands for an Entity-Relationship model. It is a high-level data model. This model
is used to define the data elements and relationship for a specified system. It develops a
conceptual design for the database. It also develops a very simple and easy to design view
of data.
For example, Suppose we design a school database. In this database, the student will be an
entity with attributes like address, name, id, age, etc. The address can be another entity with
attributes like city, street name, pin code, etc and there will be a relationship between them.
Consider another example to model a concept as an entity set rather than an attribute as
shown in below:
27
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
It records the interval during which an employee works for a department. Now suppose that it
is possible for an employee to work in a given department over more than one period. This
possibility is ruled out by the ER diagram's semantics. The problem is to record several
values for the descriptive attributes for each instance of the Works_In2 relationship. May
address this problem by introducing an entity set called, say, Duration, with attributes from
and to, as shown in below the Figure
28
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
There is at most one employee managing a department, but a given employee could manage
several departments; we store the starting date and discretionary budget for each manager-
department pair. This approach is natural if we assume that a manager receives a separate
discretionary budget for each department that he or she manages. But what if the
discretionary budget is a sum that covers all departments managed by that employee? In this
case each Manages2 relationship that involves a given employee will have the same value in
the dbudget field. In general such redundancy could be significant and could cause a variety
of problems.
The first requirement suggests that, it impose a key constraint on Policies with respect to
Covers, but this constraint has the effect that a policy can cover only one dependent. The
29
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
second requirement suggests that, it impose a total participation constraint on Policies. This
solution is acceptable if each policy covers at least one dependent.
The third requirement forces to introduce an identifying relationship that is binary as show in
below:
As a good example of a ternary relationship, consider entity sets Parts, Suppliers, and
Departments, and a relationship set Contracts that involves all of them. A contract specifies
that a supplier will supply a part to a department. This relationship cannot be adequately
captured by a collection of binary
relationships without the use of aggregation. With binary relationships, can denote that a
supplier `can supply' certain parts, that a department `needs' some parts, or that a department
`deals with' a certain supplier.
30
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor
DATABASE MANAGEMENT SYSTEMS SUB CODE:20A1302
We have thus far concentrated on the constructs available in the ER model for describ-
ing various application concepts and relationships. The process of conceptual design consists
of more than just describing small fragments of the application in terms of ER diagrams. For
a large enterprise, the design may require the efforts of more than one designer and span data
and application code used by a number of user groups. Using a high-level, semantic data
model such as ER diagrams for conceptual design in such an environment offers the additional
advantage that the high-level design can be diagrammatically represented and is easily
understood by the many people who must provide input to the design process. An important
aspect of the design process is the methodology used to structure the development of the
overall design and to ensure that the design takes into account all user requirements and is
consistent. The usual approach is that the requirements of various user groups are considered,
any conflicting requirements are somehow resolved, and a single set of global requirements is
generated at the end of the requirements analysis phase. Generating a single set of global
requirements is a difficult task, but it allows the conceptual design phase to proceed with the
development of a logical schema that spans all the data and applications throughout the
enterprise
31
DEPT OF CSE ,ASCET Mrs.B.Sravni, Assistant Professor