Dbms Lecture Notes Unit 1
Dbms Lecture Notes Unit 1
AY: 2023-2024
YEAR : II
SEMESTER : II
STREAM : CSE
VERIFIED BY
HOD – SPECIAL BATCH
INFORMATION
Processed data to carrying out useful the business activities is called information
DATABASE
A database is a collection of data, typically describing the activities of one or more related
organizations.
For example, a university database might contain information about the following:
Entities such as students, faculty, courses, and classrooms.
Relationships between entities, such as students' enrollment in courses, faculty
teaching courses, and the use of rooms for courses.
ADVANTAGES OF A DBMS:
Data independence:
Application programs should be as independent as possible from details of data
representation and storage. The DBMS can provide an abstract view of the data to
insulate application code from such details.
While the Relational Model is the most widely used database model, there are other models too:
Hierarchical Model
Network Model
Entity-relationship Model
Relational Model
Object Oriented Data Base Model
1.2.1 Hierarchical Model
This database model organizes data into a tree-like-structure, with a single root, to
which all the other data is linked. The hierarchy starts from the Root data, and
expands like a tree, adding child nodes to the parent nodes.
In this model, a child node will have a single parent node.
This model efficiently describes many real-world relationships.
Hierarchical model represents tree-like structure with one one-to-many relationship
between two different types of data, for example, one department can have many
courses, many professors and many students.
Advantages:
College
Simplicity: The design is simple and
more logical.
Data Integrity: The data can Department Infrastructure
always be referred to the parent data
for integrity. Course Teachers Students
Fig.1.1 Hierarchical Model
B. TECH – COMPUTER SCINCE AND ENGINEERING – GNITC (SPECIAL BATCH)
Disadvantages:
Searching for data requires the DBMS to run through the entire model from top to
bottom until the required information is found, making queries very slow.
This model support only one-to-many relationships, many-to-many relationships are
not supported.
1.2.2 Network Model
Network Database Model organizes the data using Graph like structures. It allows a
record to have more than one parent.
In this database model, data is more related as more relationships are established in
this model. Hence accessing the data is also easier and faster. This database model
was used to map many-to-many data relationships.
This was the most widely used database model, before Relational Model was introduced.
Advantage
College
• The network model is conceptually simple and
easy to design.
• The network model can handle the one to many Department Infrastructure
and many to many relationships.
• The data access is easier and flexible than the
hierarchical model. Students
• The network model is better than the
hierarchical model in isolating the programs Fig. 1.2 Network Model
from the complex physical storage details
Disadvantage:
• All the records are maintained using pointers and hence the whole database
structure becomes very complex.
• The insertion, deletion and updating operations of any record require the large
number of pointers adjustments.
• The structural changes to the database are very difficult.
1.2.3Entity-relationship Model
• Object-oriented databases can handle the different types of data, for example, pictures,
voice video, including text, numbers and so on.
• Object-oriented databases provide us code reusability, real world modelling, and
improved reliability and flexibility.
• The object-oriented database is having low maintenance costs because most of the
LEVELS OF ABSTRACTION
Data abstraction is a process of hiding the implement details (such as how the data are
stored and maintained) and representing only the essential features to simplify user's
interaction with the system.
The major purpose of a database system is to provide users with an abstract view of the
system. The database description consists of a schema at each of these three levels of
abstraction as shown in fig 1.7:
Conceptual schema
Physical schema
External schema
A physical schema can be defined as the design of a database at its physical level. In this
level, it is expressed how data is stored in blocks of storage.
The process of arriving at a good physical schema is called physical database design.
A logical schema can be defined as the design of the database at its logical level. In this
level, the programmers as well as the database administrator (DBA) work. At this level,
data can be described as certain types of data records which can be stored in the form of
data structures. However, the internal details (such as an implementation of data
structure) will be remaining hidden at this level.
The process of arriving at a good conceptual schema is called conceptual database design
View schema can be defined as the design of the database at view level which
generally describes end-user interaction with database systems.
Highest level of abstraction.
Describes only part of the database for a particular group of users.
Can provide many different views of a database.
DATA INDEPENDENCE
Data independence refers characteristic of being able to modify the schema at one level
of the database system without altering the schema at the next higher level.
Data independence is achieved through use of the three levels of data abstraction;
There are two types of data independence:
Logical Data Independence
Logical data independence refers characteristic of being able to change the
conceptual schema without having to change the external schema.
Logical data independence is used to separate the external level from the conceptual view.
If we do any changes in the conceptual view of the data, then the user view of
the data would not be affected.
Logical data independence occurs at the user interface level.
Physical Data Independence
Physical data independence can be defined as the capacity to change the internal
schema without having to change the conceptual schema.
If we do any changes in the storage size of the database system server, then the
Conceptual structure of the database will not be affected.
Physical data independence is used to separate conceptual levels from the internal levels.
Physical data independence occurs at the logical interface level.
STRUCTURE OF A DBMS
The DBMS accepts SQL commands generated from a variety of user interfaces,
produces query evaluation plans, executes these plans against the database, and returns
the answers.
Figure 1.8 shows the structure of a typical DBMS based on the relational data model.\
Query Evaluation Engine consists of the following components:
Parser: The query parser breaks the query into tokens. It also ensures that the
Requirements Analysis
Requirements Analysis is the process of determining what the database is to be used for.
It involves interviews with user groups and other stakeholders to identify
what functionality they require from the database, what kinds of data they
wish to process and the most frequently performed operations.
This discussion is at a non-technical level and enables the database
designers to understand the business logic behind the desired database.
Gathered information is organized and presented using suitable tools.
Conceptual database design:
Once the information is gathered in the requirements analysis step, a
conceptual database design is developed. This step is often carried out
using the ER model, or a similar high-level data model.
The ER Model is used to create a simple description of the data that
All entities in an entity set have the same set of attributes In ER diagram,
Attributes describe the properties of entities in the entity set. (Eg. Attributes
of Employees entity are SSN, Name, Lot, etc.,
Each attribute has a domain.
Based on the values of certain attributes, an entity can be identified uniquely.
Types of Entity Sets-
An entity set may be of the following two types
1.strong entity set
2.weak entity set
Strong Entity Set
Example- ‘ Works in’ is a relationship that exists between entities Employee and Department.
Relationship Set-
Example-
The number of entity sets that participate in a relationship set is termed as the degree of that
relationship set. Thus, On the basis of degree of a relationship set, a relationship set can be classified
into the following types
Types of Relationship Sets-
An entity set can participate in a relationship set with itself. Entities in same set play different roles
in the relationship. Role indicators express the role
Example-
1.Many-to-Many Cardinality-
2.One-to-One Cardinality-
Example-
2.4.2.Participation Constraints:
Example:
Every department must have a manager. So “Departments” entity set has total
participation in Manages relationship
Represented as thickened line (there is a key constraint as well)
2.Partial participation
Not every department has a manager, So “Departments” entity set has partial participation
Entity types that do not have key attributes of their own are called as weak entity types.
A weak entity set can be identified uniquely only by considering the primary key of another
(Identifying owner) owner
For any weak entity set, following restrictions must hold.
a. The owner entity set and the weak entity set must participate in a One-to-many
Representation
Dark lines: to draw weak entity set & its identifying relationship set (with
one-many relationship constraint)
Broken line: to underline a partial key
Example:
‘Dependents’ is an example of a weak entity set which is uniquely identified by (ssn, pname)
‘dpname’ is a partial key for dependents. Policy: identifying relationship set
Class Hierarchies
Aggregation:
Aggregration is the process of transforming a relationship set into an entity set for the purpose
Depends upon use of address information, and the semantics of the data:
If several addresses per employee, address must be an entity (since attributes
cannot be set- valued).
If structure (city, street, etc.) is important, address must be modeled as an entity
(since attribute values are atomic).
Entity vs Relationship
Works_In4 does not allow an employee to work in a department for two or
more periods
If wanting to record several working periods for an employee in Work_In4 Introduce new entity
set, Duration
• For each department a professor works in, a time percentage is associated with their job
• Graduate students have one major department in which they are working on their degree
• Each graduate student has another, more senior graduate student who
advises him or her on what courses to take