DBMS Complete Unit 1 Material
DBMS Complete Unit 1 Material
UNIT – II
UNIT - III
UNIT – IV
UNIT - V
Data on External Storage, File Organization and Indexing, Cluster Indexes, Primary
and Secondary Indexes, Index data Structures, Hash Based Indexing, Tree base
Indexing, Comparison of File Organizations, Indexes and Performance Tuning,
Intuitions for tree Indexes, Indexed Sequential Access Methods (ISAM), B+ Trees: A
Dynamic Index Structure.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Chapter-1
2, 7, 9, 3, 5
This is an example of data. It's just raw, unprocessed facts or figures that don't have much
meaning on their own.
Now, let's say you organize this list of numbers from smallest to largest and add a label to
indicate that they represent the scores of five different students on a test:
Student Scores: 2, 3, 5, 7, 9
This is an example of information. The data has been organized and given context so that
it now has meaning and can be used to draw conclusions or make decisions.
What is a Database:
A database is an organized collection of structured information, typically stored
electronically in a computer system. A database is usually controlled by a database
management system (DBMS). A Database is a collection of related data organised in a
way that data can be easily accessed, managed and updated. Database can be software
based or hardware based, with one sole purpose, storing data. Databases can store data
in the form of tables depending upon the type of database.
During early computer days, data was collected and stored on tapes, which were mostly
write-only, which means once data is stored on it, it can never be read again. They were
slow and bulky, and soon computer scientists realised that they needed a better solution to
this problem. databases provide a powerful tool for managing data, enabling organizations
to store and access large amounts of information in an efficient and reliable manner.
What is DBMS:
A Database Management System (DBMS) is a software that allows creation, definition and
manipulation of database, allowing users to store, process and analyse data easily. DBMS
provides us with an interface or a tool, to perform various operations like creating
database, storing data in it, updating data, creating tables in the database and a lot more.
DBMS also provides protection and security to the databases. It also maintains data
consistency in case of multiple users.
MySql
Oracle
SQL Server
IBM DB2
PostgreSQL
Amazon SimpleDB (cloud based) etc.
Edgar F. Codd is credited with being the founder of the relational database management
system (RDBMS), which is a type of DBMS. In the early 1970s, Codd developed the
concept of a relational database, which is a database that organizes data into one or more
tables with a unique key identifying each row. This concept laid the foundation for modern
DBMSs, and many of the principles he developed are still in use today.
Data is never directly stored into the database. Data is stored into tables, created inside
the database. DBMS also allows to have relationships between tables which makes the
data more meaningful and connected. You can easily understand what type of data is
stored where by looking at all the tables created in a database.
2. Reduced Redundancy:
In the modern world hard drives are very cheap, but earlier when hard drives were too
expensive, unnecessary repetition of data in database was a big problem. But DBMS
follows Normalisation which divides the data in such a way that repetition is minimum.
3. Data Consistency:
On Live data, i.e. data that is being continuously updated and added, maintaining the
consistency of data can become a challenge. But DBMS handles it all by itself.
DBMS allows multiple users to work on it(update, insert, delete data) at the same time and
still manages to maintain the data consistency.
5. Query Language:
DBMS provides users with a simple Query language, using which data can be easily
fetched, inserted, deleted and updated in a database.
6. Security:
The DBMS also takes care of the security of data, protecting the data from un-authorised
access. In a typical DBMS, we can create user accounts with different access permissions,
using which we can easily secure our data by restricting user access.
7. Data Integrity:
For complete DBMS subject tutorials visit : ns lectures youtube channel
DBMS ensures data integrity by providing mechanisms to maintain the correctness and
completeness of the data.
DBMS provides backup and recovery mechanisms to ensure that data can be restored in
the event of a failure or disaster.
1. Data Definition:
The DBMS allows users to define the structure of the database, including tables, fields,
and relationships between tables. This task is also referred to as schema definition.
2. Data Manipulation:
The DBMS allows users to insert, update, delete, and retrieve data from the database.
This task is also known as query processing.
3. Data Retrieval:
The DBMS provides a query language that allows users to retrieve data from the
database. The most common query language used in DBMS is SQL (Structured Query
Language).
4. Data Security:
The DBMS provides mechanisms to ensure data security and prevent unauthorized
access to the database.
5. Data Integrity:
The DBMS ensures data integrity by enforcing data constraints, such as primary key and
foreign key constraints.
The DBMS provides mechanisms to backup and restore the database in case of data loss
or corruption.
7. Concurrency Control:
The DBMS ensures that multiple users can access the database simultaneously without
conflicts. This is achieved through techniques such as locking and transaction
management.
Advantages of DBMS
1. Improved Data Sharing:
For complete DBMS subject tutorials visit : ns lectures youtube channel
DBMS enables multiple users to access and share data simultaneously from different
locations, leading to increased collaboration and better decision-making.
2. Data Security:
DBMS provides various mechanisms to ensure data security, including access controls,
authentication, and encryption.
3. Data Consistency:
DBMS enforces data constraints, ensuring that data is consistent and accurate.
4. Backup:
It automatically backs up data to maintain its integrity in case of failure.
5. Controls database redundancy:
All the data is stored in one place, and that recorded in the database and hence controls
the redundancy in the database.
6. Data Integrity:
DBMS ensures that data is complete and accurate, helping to maintain the quality of data.
7. Easy Data Backup and Recovery:
DBMS provides mechanisms for backing up and restoring data, making it easier to
recover from data loss or corruption.
Disadvantages of DBMS
1. Cost of software and hardware:
It requires a number of high powered processors and large size memory to run DBMS.
2. Complexity:
DBMS can be complex and require specialized knowledge and expertise to set up and
maintain.
3. Size:
a Large amount of storage size is required to run DBMS efficiently.
Applications of DBMS
In so many fields, we will use a database management system.
Let’s see some of the applications where database management system uses −
1. Railway Reservation System –
The railway reservation system database plays a very important role by keeping record of
ticket booking, train’s departure time and arrival status and also gives information
regarding train late to people through the database.
2. Library Management System –
For complete DBMS subject tutorials visit : ns lectures youtube channel
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.
3. Banking –
Banking is one of the main applications of databases. We all know there will be a thousand
transactions through banks daily and we are doing this without going to the bank. This is
all possible just because of DBMS that manages all the bank transactions.
4. Universities and colleges –
Now-a-days examinations are done online. So, the universities and colleges are
maintaining DBMS to store Student’s registrations details, results, courses and grade all
the information in the database. For example, telecommunications. Without DBMS there is
no telecommunication company. DBMS is most useful to these companies to store the call
details and monthly postpaid bills.
5. Credit card transactions –
The purchase of items and transactions of credit cards are made possible only by DBMS.
A credit card holder has to know the importance of their information that all are secured
through DBMS.
6. 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, Pinterest and Instagram. All the
information related to the users are stored and maintained with the help of DBMS.
7. Finance –
Now-a-days there are lots of things to do with finance like storing sales, holding
information and finance statement management etc. these all can be done with database
systems.
8. Military –
In military areas the DBMS is playing a vital role. Military keeps records of soldiers and it
has so many files that should be kept secure and safe. DBMS provides a high security to
military information.
9. Online Shopping –
Now-a-days we all do Online shopping without wasting the time by going shopping with the
help of DBMS. The products are added and sold only with the help of DBMS like Purchase
information, invoice bills and payment.
10. Human Resource Management –
The management keeps records of each employee’s salary, tax and work through DBMS.
11. Manufacturing –
Manufacturing companies make products and sell them on a daily basis. To keep records
of all those details DBMS is used.
12. Airline Reservation system –
Just like the railway reservation system, airlines also need DBMS to keep records of flights
arrival, departure and delay status.
So finally, we can clearly conclude that the DBMS is playing a very important role in each
and every field.
For complete DBMS subject tutorials visit : ns lectures youtube channel
In the early 1960s, the first DBMSs were developed to manage large amounts of data for
scientific and military applications. These early systems were primarily used for data
storage and retrieval, and were designed for use on mainframe computers.
One of the earliest DBMSs was the Integrated Data Store (IDS) developed by General
Electric in the early 1960s. IDS was one of the first DBMSs to provide a high-level data
definition language (DDL) and a high-level data manipulation language (DML).
In the 1970s, the development of the relational model by Edgar F. Codd revolutionized the
field of DBMSs. The relational model provided a way to represent data in a tabular format,
with each row representing a single entity and each column representing a single attribute
of that entity. The relational model also introduced the concept of normalization, which is a
way to eliminate redundancy and improve data integrity.
The first commercial relational DBMS was the System R system developed by IBM in the
mid-1970s. Other popular relational DBMSs include Oracle, Microsoft SQL Server, and
MySQL.
In the 1990s, web-based DBMSs emerged, allowing users to access data through a web
browser. This made it easier to share data across different systems and locations.
For complete DBMS subject tutorials visit : ns lectures youtube channel
In the early 2000s, NoSQL databases were developed to address the need for scalable,
high-performance databases that could handle large volumes of unstructured data. NoSQL
databases use non-relational data models and can be used in distributed computing
environments.
Today, DBMSs are an essential part of modern computing, used in a wide range of
applications, from banking and finance to healthcare and scientific research. They
continue to evolve, with new features and capabilities being added to address the ever-
increasing demands of modern data-driven applications.
File based systems were an early attempt to computerize the manual system. It is also
called a traditional based approach in which a decentralized approach was taken where
each department stored and controlled its own data with the help of a data processing
specialist. The main role of a data processing specialist was to create the necessary
computer file structures, and also manage the data within structures and design some
application programs that create reports based on file data.
Consider an example of a student's file system. The student file will contain information
regarding the student (i.e. roll no, student name, course etc.). Similarly, we have a subject
file that contains information about the subject and the result file which contains the
information regarding the result.
Some fields are duplicated in more than one file, which leads to data redundancy. So to
overcome this problem, we need to create a centralized system, i.e. DBMS approach.
DBMS:
various operations performed by the DBMS system are: Insertion, deletion, selection,
sorting etc.
These are the following differences between DBMS and File systems:
It has a comparatively
It is less expensive than DBMS. higher cost than a file
Cost system.
Only one user can access data at a Multiple users can access
User Access time. data at a time.
Data Model
Data Model gives us an idea that how the final system will look like after its complete
implementation. It defines the data elements and the relationships between the data
elements. Data Models are used to show how data is stored, connected, accessed and
updated in the database management system. Here, we use a set of symbols and text to
represent the information so that members of the organisation can communicate and
understand it. Though there are many data models being used nowadays but the
Relational model is the most widely used model. Apart from the Relational model, there
are many other types of data models about which we will study in details in this blog.
Some of the Data Models in DBMS are:
1. Hierarchical Model
2. Network Model
3. Entity-Relationship Model
4. Relational Model
5. Object-Oriented Data Model
6. Object-Relational Data Model
7. Flat Data Model
8. Semi-Structured Data Model
For complete DBMS subject tutorials visit : ns lectures youtube channel
1. Hierarchical Model:
Hierarchical Model was the first DBMS model. This model organises the data in the
hierarchical tree structure. The hierarchy starts from the root which has root data and
then it expands in the form of a tree adding child node to the parent node. This model
easily represents some of the real-world relationships like food recipes, sitemap of a
website etc. Example: We can represent the relationship between the shoes present on
a shopping website in the following way:
1. One-to-many relationship: The data here is organised in a tree-like structure where the
one-to-many relationship is between the datatypes. Also, there can be only one path
from parent to any node. Example: In the above example, if we want to go to the
node sneakers we only have one path to reach there i.e through men's shoes node.
2. Parent-Child Relationship: Each child node has a parent node but a parent node can
have more than one child node. Multiple parents are not allowed.
3. Deletion Problem: If a parent node is deleted then the child node is automatically
deleted.
4. Pointers: Pointers are used to link the parent node with the child node and are used to
navigate between the stored data. Example: In the above example the ' shoes ' node
points to the two other nodes ' women shoes ' node and ' men's shoes ' node.
Advantages of Hierarchical Model
2. Network Model:
This model is an extension of the hierarchical model. It was the most popular model
before the relational model. This model is the same as the hierarchical model, the only
difference is that a record can have more than one parent. It replaces the hierarchical
tree with a graph. Example: In the example below we can see that node student has two
parents i.e. CSE Department and Library. This was earlier not possible in the hierarchical
model.
1. Ability to Merge more Relationships: In this model, as there are more relationships so
data is more related. This model has the ability to manage one-to-one relationships as
well as many-to-many relationships.
2. Many paths: As there are more relationships so there can be more than one path to the
same record. This makes data access fast and simple.
3. Circular Linked List: The operations on the network model are done with the help of the
circular linked list. The current position is maintained with the help of a program and this
position navigates through the records according to the relationship.
Advantages of Network Model
The data can be accessed faster as compared to the hierarchical model. This is because
the data is more related in the network model and there can be more than one path to
reach a particular node. So the data can be accessed in many ways.
As there is a parent-child relationship so data integrity is present. Any change in parent
record is reflected in the child record.
Disadvantages of Network Model
As more and more relationships need to be handled the system might get complex. So, a
user must be having detailed knowledge of the model to work with the model.
Any change like updation, deletion, insertion is very complex.
For complete DBMS subject tutorials visit : ns lectures youtube channel
3. Entity-Relationship Model:
Entity-Relationship Model or simply ER Model is a high-level data model diagram. In this
model, we represent the real-world problem in the pictorial form to make it easy for the
stakeholders to understand. It is also very easy for the developers to understand the
system by just looking at the ER diagram. We use the ER diagram as a visual tool to
represent an ER Model. ER diagram has the following three components:
In the above diagram, the entities are Teacher and Department. The attributes
of Teacher entity are Teacher_Name, Teacher_id, Age, Salary, Mobile_Number. The
attributes of entity Department entity are Dept_id, Dept_name. The two entities are
connected using the relationship. Here, each teacher works for a department.
Features of ER Model:
Easy Conversion to any Model : This model maps well to the relational model and can
be easily converted relational model by converting the ER model to the table. This model
can also be converted to any other model like network model, hierarchical model etc.
Disadvatages of ER Model:
4. Relational Model:
Relational Model is the most widely used model. In this model, the data is maintained in
the form of a two-dimensional table. All the information is stored in the form of row and
columns. The basic structure of a relational model is tables. So, the tables are also
called relations in the relational model. Example: In this example, we have an Employee
table.
Tuples : Each row in the table is called tuple. A row contains all the information about
any instance of the object. In the above example, each row has all the information about
any specific individual like the first row has information about John.
Attribute or field: Attributes are the property which defines the table or relation. The
values of the attribute should be from the same domain. In the above example, we have
different attributes of the employee like Salary, Mobile_no, etc.
Advnatages of Relational Model
Simple: This model is more simple as compared to the network and hierarchical model.
Scalable: This model can be easily scaled as we can add as many rows and columns
we want.
Structural Independence: We can make changes in database structure without
changing the way to access the data. When we can make changes to the database
structure without affecting the capability to DBMS to access the data we can say that
structural independence has been achieved.
Disadvantages of Relatinal Model
For complete DBMS subject tutorials visit : ns lectures youtube channel
Hardware Overheads: For hiding the complexities and making things easier for the user
this model requires more powerful hardware computers and data storage devices.
Bad Design: As the relational model is very easy to design and use. So the users don't
need to know how the data is stored in order to access it. This ease of design can lead to
the development of a poor database which would slow down if the database grows.
But all these disadvantages are minor as compared to the advantages of the relational
model. These problems can be avoided with the help of proper implementation and
organisation.
The Object-Oriented Model in DBMS or OODM is the data model where data is stored in
the form of objects. This model is used to represent real-world entities. The data and data
relationship is stored together in a single entity known as an object in the Object Oriented
Model. The Object-Oriented Database Management System is built on top of Object
Oriented Model.
As we have discussed earlier, we can use the Object Oriented Model in DBMS to
store real-world entities. Here, we can store pictures, audio, video, and other types of data,
which was previously impossible to store with the relational approach (Even though we
can store video and audio in the relational database, it is generally not recommended).
Example
As you can see, here Student and Department are two different objects. Each one of them
has its attributes and methods. They are linked by a common attribute Dept_no which
establishes a relationship between objects.
Features:
Objects: In OODM, data is represented as objects, which are instances of classes. Each
object has its own set of attributes and methods.
Inheritance: OODM supports inheritance, which allows classes to inherit attributes and
methods from their parent classes. Inheritance helps in code reuse and simplifies the
design.
Advantages:
Reusability: OODM promotes code reuse through inheritance. Classes can be derived
from existing classes, inheriting their attributes and methods.
Modularity: OODM allows for the design of complex systems to be divided into smaller,
more manageable modules. This makes it easier to maintain and update the system.
Flexibility: OODM allows for the creation of new classes that can be tailored to specific
needs. This flexibility allows for the system to be adapted to changing requirements.
Disadvantages:
For complete DBMS subject tutorials visit : ns lectures youtube channel
Complexity: OODM can be more complex than other data models, making it more difficult
for developers to learn and use. This can lead to longer development times and higher
costs.
Performance: OODM can be slower than other data models because of the overhead
associated with creating and managing objects.
Scalability: OODM can be less scalable than other data models, as the number of objects
and the size of the system increases, the overhead associated with managing objects can
become significant.
OODM offers several advantages such as code reuse, modularity, and flexibility, but it can
also be more complex and less performant than other data models. Therefore, it is
important to consider the specific needs of the project before choosing an appropriate data
model.
6. Object-Relational Model:
As the name suggests it is a combination of both the relational model and the object-
oriented model. This model was built to fill the gap between object-oriented model and
the relational model. We can have many advanced features like we can make complex
data types according to our requirements using the existing data types. The problem with
this model is that this can get complex and difficult to handle. So, proper understanding
of this model is required.
Both Relational data models and Object oriented data models are very useful. But it was
felt that they both were lacking in some characteristics and so work was started to build a
model that was a combination of them both. Hence, Object relational data model was
created as a result of research that was carried out in the 1990’s.
Extensibility
The functionality of the system can be extended in Object relational data model. This can
be achieved using complex data types as well as advanced concepts of object oriented
model such as inheritance.
The object relational data model can get quite complicated and difficult to handle at times
as it is a combination of the Object oriented data model and Relational data model and
utilizes the functionalities of both of them.
8. Semi-Structured Model:
The Semi-Structured Data Model is a data model used in database management systems
(DBMS) that allows for the representation of data in a flexible, hierarchical, and loosely
structured manner. Unlike traditional relational database models, where data is organized
into tables with pre-defined columns and data types, semi-structured data models allow for
the storage of data with varying and evolving schema.
Features :
Flexibility: Semi-structured data model allows for the representation of data with varying
schema, making it suitable for handling complex and heterogeneous data.
Loosely structured: Semi-structured data model does not impose strict constraints on the
data schema, making it easier to handle data with evolving or unpredictable structures.
No fixed schema: Semi-structured data model does not require a predefined schema,
and the schema can evolve as the data changes or new data is added.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Advantages:
Flexibility: The semi-structured data model allows for flexibility in handling data with
varying structures, making it easier to handle complex and heterogeneous data.
Scalability: Semi-structured data model can be easily scaled to handle large and complex
data sets.
Easy integration: Semi-structured data can be easily integrated with other systems and
technologies, making it ideal for interoperability.
Reduced development time: The loosely structured nature of the semi-structured data
model reduces development time as schema changes can be made without affecting the
entire database.
Disadvantages:
Query complexity: Querying semi-structured data can be complex, as the data may be
stored in a nested and hierarchical format.
Storage overhead: The flexibility of the semi-structured data model can lead to increased
storage overhead, as redundant data may be stored in different formats.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Item: Items contain the name and the identifier (some numeric value).
Links: Links contain the identifier, source, verb and subject.
Example: Let us suppose we have three tables Employee, Department and Project.
So, we can represent the schema of these three tables using the schema diagram
as follows. In this schema diagram, Employee and Department are related and the
Employee and Project table are related.
Data Abstraction is a process of hiding unwanted or irrelevant details from the end user.
The developers keep away the complex data from the user and remove the complications
so that the user can comfortably access data in the database and can only access the
data they want, which is done with the help of data abstraction.
For complete DBMS subject tutorials visit : ns lectures youtube channel
The main purpose of data abstraction is to hide irrelevant data and provide an abstract
view of the data. With the help of data abstraction, developers hide irrelevant data from the
user and provide them the relevant data. By doing this, users can access the data without
any pressure, and the system will also work efficiently.
In DBMS, data abstraction is performed in layers which means there are levels of data
abstraction in DBMS that we will further study in this article. Based on these levels, the
database management system is designed.
Levels of abstraction for DBMS (or) three levels of the schema (or)
Three tier schema Architecture:
Database systems include complex data-structures. In terms of retrieval of data, reduce
complexity in terms of usability of users and in order to make the system efficient,
developers use levels of abstraction that hide irrelevant details from the users. Levels of
abstraction simplify database design.
Mainly there are three levels of abstraction for DBMS, which are as follows −
Physical or Internal Level
Logical or Conceptual Level
View or External Level
In DBMS, there are three levels of data abstraction, which are as follows:
The physical or internal layer is the lowest level of data abstraction in the database
management system. It is the layer that defines how data is actually stored in the
database. It defines methods to access the data in the database. It defines complex data
structures in detail, so it is very complex to understand, which is why it is kept hidden from
the end user.
Data Administrators (DBA) decide how to arrange data and where to store data. The Data
Administrator (DBA) is the person whose role is to manage the data in the database at the
physical or internal level. There is a data center that securely stores the raw data in detail
on hard drives at this level.
In database design, the conceptual level refers to the highest level of abstraction,
where the focus is on understanding the overall structure and meaning of the data
being stored, rather than the specific implementation details of the database system.
At the conceptual level, the database designer creates a data model, which defines the
entities, attributes, and relationships of the data. This schema is independent of any
specific database management system (DBMS), and serves as a blueprint for the
design and implementation of the database system. In the logical level, the data model
is transformed into a logical schema, which includes the specific tables, columns, and
constraints needed to implement the database.
It describes the structure of the entire data in the form of tables. The logical level or
conceptual level is less complex than the physical level. In software companies, the
conceptual level of the database is typically handled by a team of database designers or
data architects. These individuals are responsible for understanding the data requirements
of the organization and creating a conceptual schema that reflects those requirements.
However, the database designers may continue to be involved in the ongoing maintenance
and evolution of the database, to ensure that it continues to meet the needs of the
organization over time.
After the data model has been created, the logical database design phase typically
follows, where the data model is translated into a physical schema that includes
specific tables, columns, and constraints, along with any necessary optimization and
indexing for performance and scalability. This phase is typically handled by database
developers, rather than database architects.
Example: If we have to define an employee schema then it will have attributes like
Emlpoyee_id, Name, Age, Salary, Phone_no etc. So, the data types for these attributes
would be defined here. Also, if we have more than one table in our schema then how
these tables would be related is also defined here. Like if we have some more tables
like department table and project table then how these tables would be related is
defined here.
Example : A website has different views depending upon the user's authorization. A
college website has a different view for students, faculty and dean. Similarly, a
companies website would have a different view for the employee, accountant and
manager.
1.Multiple levels:
2.Separation of concerns:
Data abstraction separates the concerns of different users and stakeholders, such as
users, designers, and administrators, by providing a clear separation between the
logical and physical implementation of the database system.
Data abstraction provides a mapping between the different levels of abstraction, which
ensures that changes made at one level do not affect the other levels.
Data Independence
The ability to modify the schema definition of a DBMS at one level, without affecting the
schema definition of the next higher level is called data independence. Its goal is to
make data independent of the user. Data independence is one of the important
characteristics of database management system. The database contains a tremendous
amount of data which is hard to handle if it is stored in one place. But with the usage
database management system expanding, there is a need to change the data over time
to satisfy the requirements.
So there is a multilayer architecture, such that modifications done at one level won’t
affect another. We have two types of data independence-Logical data independence
and physical data independence which can be explained by various levels. The various
levels of abstraction -physical level, logical level, and view level.
For complete DBMS subject tutorials visit : ns lectures youtube channel
This is defined as the ability to modify the physical schema of the database without
the modification causing any changes in the logical/conceptual or view/external level.
Physical Data Independence means changing the physical level without affecting the
logical level or conceptual level. Using this property, we can change the storage
device of the database without affecting the logical schema.
Logical data independence is the ability to modify logical schema without causing
any unwanted modifications to the external schema or the application programs to
be rewritten. In other words, changes to the way the data is organized, structured, or
represented in the database can be made without requiring changes to the application
programs that use the data.
Ease of Retrieving We can easily retrieve it. Retrieving is very difficult because the
data mainly depends on its logical
structure and not its physical location.
Degree of Changes The changes made at the physical Any changes made at the physical level
level need not be made at the need to be made at the application level
For complete DBMS subject tutorials visit : ns lectures youtube channel
Internal We may or may not need the Making modifications at the logical level
Modification modifications at the internal level for is a prerequisite whether we want to
improving the performance of a change the database structure or not.
system’s structure.
Type of Schema The internal schema is the primary The conceptual schema is the primary
concern. concern.
Instance
Instance or extension or database state is a collection of information that stored in a
database at a particular moment is called an instance of the database. The
Database instance refers to the information stored in the database at a given point of
time. Thus, it is a dynamic value which keeps on changing.
Example:
A database instance for the Person database can be
(User1,emai.com,11345679,addr) So the person construct will contain their
individual entities in the attributes called as instance. This is shown below −
Person
Name Email Phone no
Example” We take two tables emp table and At a moment, what is the value of the database
dept table.Emp schema is called instance.At t=8 A.M
Name 1 A 5000 d1
Salary 2 B 2000 d2
At t=9 A.M
dept
3
Dept
C
Dept_id
3000
dname
d3
Emp and dept both called as schemas as It Empid 1 and 2 are called as Instance 1At time 9 A.M
gives database definition instance 2 changes
This corresponds to the variable declaration of a The value of the variable in a program at a point in
programming language. time corresponds to an instance of the database
schema.
DBMS Architecture
o The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers,
database servers and other components that are connected with networks.
o The client/server architecture consists of many PCs and a workstation which
are connected via the network.
o DBMS architecture depends upon how users are connected to the database
to get their request done.
1-Tier Architecture:
o In this architecture, the database is directly available to the user. It means the
user can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick
response.
2-Tier Architecture:
o The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate with the
database at the server side. For this interaction, API's like: ODBC, JDBC are
used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query
processing and transaction management.
o To communicate with the DBMS, client-side application establishes a
connection with the server side.
3-Tier Architecture:
o The 3-Tier architecture contains another layer between the client and server. In this
architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which further
communicates with the database system.
o End user has no idea about the existence of the database beyond the application
server. The database also has no idea about any other user beyond the
application.
o The 3-Tier architecture is used in case of large web application.
For complete DBMS subject tutorials visit : ns lectures youtube channel
overall system.
• The functional components are broadly divided into the users, interface, query processor
components, and the storage manager.
Primary goal:- retrieving information from and storing new information into the database
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.
I. SYSTEM USERS:
four different types of database-system users,
1. Application programmers
2. Naive users
3. Sophisticated users and Specialized users:-
4. Database Administrator
For complete DBMS subject tutorials visit : ns lectures youtube channel
1. Application Developers:
2. Naive users
• Naive users are unsophisticated users.
• Interact with the system by the permanent application programs that have been
written previously.
• For example, the clerk at the ticket booking window, he uses an application
program to do his job of making reservations for a passenger.
3.Sophisticated users:
Sophisticated users interact 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.
4.Specialized users :
Database installation and configuration: The DBA is responsible for installing and
configuring the database software on the servers that will host the database. This
includes setting up the database parameters, file structures, and security settings.
Database backup and recovery: The DBA is responsible for ensuring that the
database system is regularly backed up, and there is a disaster recovery plan in
place to recover the system in case of a failure or disaster.
Database security: The DBA is responsible for managing the database security,
including setting up user accounts and permissions, encrypting sensitive data, and
implementing security protocols to prevent unauthorized access or data breaches.
the DBA's role is crucial in maintaining the database system's integrity, security, and
performance. They need to work closely with other stakeholders such as developers,
system administrators, and end-users to ensure that the database system meets the
organization's business requirements and provides reliable and efficient services.
I. Query Processor:
In database architecture, a query processor is a crucial component responsible for
interpreting and executing user queries against the database. Its primary function is
to transform high-level queries expressed in a database query language (such as
SQL) into a sequence of low-level operations that can be efficiently executed by the
database engine.Its tasks include parsing and validating queries, optimizing query
execution plans, coordinating data retrieval and manipulation, and formatting and
delivering the query results. The efficiency and effectiveness of the query processor
directly impact the performance and scalability of the database system.
• A query processor helps the database system simplify and facilitate data access.
• System users are not required to know physical details of the implementation of
the system.
• Quick processing of updates.
In a database management system (DBMS), the DML compiler and organizer are
components responsible for processing and executing Data Manipulation Language
(DML) queries and coordinating the associated data manipulation operations.
a) DML Compiler:
For complete DBMS subject tutorials visit : ns lectures youtube channel
b) DML Organizer:
The DML organizer, also known as the query executor or coordinator, is responsible
for executing the execution plan generated by the DML compiler.
The query evaluation engine, also known as the query execution engine or query
processor, is a crucial component in a database management system (DBMS). It is
responsible for executing user queries and retrieving the requested data from the
database. Here are some key uses of the query evaluation engine:
a) Query Parsing and Validation: The query evaluation engine parses the user's
query and validates its syntax and structure. It checks for proper query formation,
keywords, and adherence to the query language's grammar rules. If the query is
invalid, the engine generates an error message to alert the user.
b) Query Optimization: The query evaluation engine optimizes the execution plan
of the query to ensure efficient and fast data retrieval. It considers various factors
such as available indexes, statistics, and cost estimates to determine the most
optimal strategy for query execution. The optimization process aims to minimize the
use of system resources and reduce the query's response time.
d) Data Retrieval and Manipulation: The query evaluation engine coordinates the
retrieval and manipulation of data according to the generated query plan. It
For complete DBMS subject tutorials visit : ns lectures youtube channel
interacts with other components of the DBMS, such as the storage manager and
buffer manager, to efficiently access and retrieve data from disk or memory. The
engine performs operations like table scans, index lookups, join operations,
aggregations, and sorting to retrieve the requested data.
f) Result Formatting and Delivery: After executing the query, the query evaluation
engine formats the result set according to the specified output format. It may format
the results as tables, reports, or other appropriate formats based on user
requirements. The engine then delivers the formatted results to the user or
application that initiated the query.
The query evaluation engine plays a vital role in processing user queries and
retrieving data from a database. It ensures efficient execution, optimization, and
coordination of queries, providing users with accurate and timely access to the
desired information.
A storage manager is a program module which acts like interface between the data
stored in a database and the application programs and queries submitted to the
system.
Thus, the storage manager is responsible for storing, retrieving and updating data in
the database.
The raw data are stored on the disk using the file system, which is usually provided
by a conventional operating system.
• The storage manager translates the various DML statements into low-level file
system commands.
• The storage manager is responsible for storing, retrieving, and updating data in the
database.
• A large amount of storage space is required for storing corporate databases (which
may range from hundreds to gigabytes to terabytes of data) and to manage this
storage manager is required.
• We need to move data from disk storage to main memory as per requirement
because the main memory of the computer cannot store this much information
Authorization and integrity manager, which tests for the satisfaction of integrity
constraints and checks the authority of users to access data.
For complete DBMS subject tutorials visit : ns lectures youtube channel
File manager, which manages the allocation of space on disk storage and the data
structures used to represent information stored on disk.
Buffer manager, which is responsible for fetching data from disk storage into main
memory, and deciding what data to cache in main memory. The buffer manager is a
critical part of the database system, since it enables the database to handle data
sizes that are much larger than the size of main memory.
Disk Storage:
• A DBMS can use several kinds of data structures as a part of physical system
implementation in the form of disk storage.
• Each structure has its own importance.
• Following are some common data structures.
• Disk storage is the central repository for storing all kinds of data in the database.
(i) Data
• It stores the database itself on the disk in the Data files.
(iii) Indices
• Indices, which can provide fast access to data items.
• A database index provides pointers to those data items that hold a particular value.
• Hashing is an alternative to indexing that is faster in some but not all cases.
the needs and demands of the application and business stakeholders. Once you
have a solid design, you can build the database quickly. In most organizations,
database architects and database administrators (DBAs) are responsible for
designing a database. Their responsibility is to understand the business and
operational requirements of an organization, model the database based on those
requirements, and establishing who and how the database will be used. They simply
take the lead on the database design project and are responsible for the
management and control of the overall database design process.
The database design process can usually be broken down into six phases, as listed
below:
Requirement collection and analysis phase
Conceptual design phase
Logical design phase
Physical design phase
Implementation and loading phase
Testing and evaluation phase
Note: ER Model is much relevant to first three steps
The following figure briefly illustrates the database design process:
In this phase, you interview the prospective users, gather their requirements, and
discuss their expectations from the new database application. Your objective in this
phase is to gather as much information as possible from potential users and then
documenting those requirements. This phase results in a concise set of user and
functional requirements, which should be detailed and complete. Functional
requirements typically include user operations to be applied to the database,
information flow, type of operation, the frequency of transactions and data updates.
You can document functional requirements using diagrams such as sequence
diagrams, data flow diagrams (DFDs), scenarios, etc.
Requirement collection and analysis phase can take a significant amount of time;
however, it plays a vital role in the success of the new database application. The
outcome of this phase is the document that contains the user’s specifications, which
is then used as the basis for the design of the new database application.
Your goal during the conceptual design phase is to develop the conceptual schema
of the database, which is then used to ensure that all user requirements are met and
do not conflict. In this step, you select appropriate data model and then translate the
requirements arising from the preceding phase into the conceptual database schema
by applying the concepts of chosen data model, which does not depend on RDBMS.
The most general data model used in this phase is the entity-relationship (ER)
model, which is usually used to represent the conceptual database design.
Conceptual schema includes the clear description of the user’s data requirements,
including the detailed description of the entity types, relationships, and constraints.
Conceptual design phase does not include implementation details. Thus, end users
can easily understand them, and hence, can be used as a communication tool. The
information you gather during the conceptual design phase is critical to the success
of your database design.
In logical design phase, you start mapping entity-relationship (ER) model into a
relational schema. During this phase, you translate the high-level conceptual schema
implementation data model of the selected RDBMS constructs. The data model
chosen will be representing the company and its operations. The data model of
logical design will be a more detailed framework than that one developed during the
conceptual design phase. This phase provides specific guidelines, which you can
use to create the physical database design.
During the physical design phase, you make decisions about the database
environment (database server), application development environment, database files
organisation, physical database objects, etc. Physical design phase is a very
technical stage of the database design process. The result of this phase is a physical
design specification that is used to build and deploy your database solution.
During this phase, you implement the proposed database is implemented. The
phase includes activities such as, the creation of the database, compilation and
execution of DDL statements to create the database schema and database files,
manually or automatically load the data into a new database system from a previous
system, and finally configure database and application security.
In this phase, you perform testing of your database solution to tune it for
performance, integrity, concurrent access, and security restrictions. Typically this is
done in parallel with application programming phase. If the test fails, you take
several actions such as adjusting performance based on a reference manual,
physical design modification, logical design modification, upgrade or change the SQL
Server software and database server hardware.
For complete DBMS subject tutorials visit : ns lectures youtube channel
ER Model is used to model the logical view of the system from a data perspective
which consists of these symbols:
Rectangles: Rectangles represent Entities in ER Model.
Ellipses: Ellipses represent Attributes in ER Model.
Diamond: Diamonds represent Relationships among Entities.
Lines: Lines represent attributes to entities and entity sets with other
relationship types.
Double Ellipse: Double Ellipses represent Multi-Valued Attributes.
Double Rectangle: Double Rectangle represents a Weak Entity.
Entity in DBMS
Entity:
An entity is referred to as an object or thing that exists in the real world. For example,
customer, car, pen, etc.
Entities are stored in the database, and they should be distinguishable, i.e., they
should be easily identifiable from the group. For example, a group of pens that are
from the same company cannot be identified, so they are only objects, but pens with
different colours become unique and will be called an entity like a red pen, green
pen, blue pen, black pen, etc.
In a group of pens, we can easily identify any pen because of its different
colours, so a pen of different colours is an entity.
For extracting data from the database, each data must be unique in its own way so
that it becomes easier to differentiate between them. Distinct and unique data is
known as an entity.
For complete DBMS subject tutorials visit : ns lectures youtube channel
An entity has some attributes which depict the entity's characteristics. For example,
an entity "Student" has attributes such as "Student_roll_no", "Student_name",
"Student_subject", and "Student_marks".
Entity Type:
In the above example, the "Customer" is the entity type with attributes such as ID,
Name, Gender, and Phone Number. Customer is a strong entity type as it has a
unique ID for each customer.
2. Weak Entity Type:
It is an entity that does not have its own existence and relies on a strong entity for its
existence.
The Entity Relationship Diagram represents the weak entity type using double
rectangles. Below is the ERD of the weak entity type:
In the above example, "Address" is a weak entity type with attributes such as House
No., City, Location, and State.
The relationship between a strong and a weak entity type is known as an identifying
relationship.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Entity Set
An entity set is a group of entities of the same entity type.
For example, an entity set of students, an entity set of motorbikes, an entity of
smartphones, an entity of customers, etc.
Entity sets can be classified into two types:
1. Strong Entity Set:
For example, an entity of motorbikes with the attributes, motorbike's registration
number, motorbike's name, motorbike's model, and motorbike's colour.
Below is the representation of a strong entity set in tabular form:
For complete DBMS subject tutorials visit : ns lectures youtube channel
Example of Entity Relationship Diagram representation of the above weak entity set:
For complete DBMS subject tutorials visit : ns lectures youtube channel
Attributes in DBMS
An attribute is a property or characteristic of an entity. An entity may contain any
number of attributes. One of the attributes is considered as the primary key. In an
Entity-Relation model, attributes are represented in an elliptical shape.
Example: Student has attributes like name, age, roll number, and many more. To
uniquely identify the student, we use the primary key as a roll number as it is not
repeated. Attributes can also be subdivided into another set of attributes.
For example, in a customer database table, the attributes might be name, address,
and phone number. In a product database table, the attributes might be name, price,
and date of manufacture. Each attribute has a specific data type, such as string,
integer, or date.
Simple Attributes
Composite Attributes
Single Valued Attributes
Multi-Valued Attributes
Derived Attributes
Key Attributes
Complex Attributes (Rarely used attributes)
Now, we will study all of these different types of attributes in DBMS in detail along
with their diagrams and examples :)
1. Simple Attributes
Example Diagram:
that we can't further 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
Example Diagram:
2. Single-Valued Attributes
Single valued attributes are those attributes that consist of a single value for each
entity instance and can't store more than one value. The value of these single-valued
attributes always remains the same, just like the name of a person.
Example Diagram:
As we can see in the above example, Student is an entity instance, and it consists of
attributes: Roll_no, Age, DOB, and Gender. These attributes can store only one
value from a set of possible values. Each entity instance can have only one Roll_no,
which is a unique, single DOB by which we can calculate age and also fixed gender.
Also, we can't further subdivide these attributes, and hence, they are simple as well
as single-valued attributes.
For complete DBMS subject tutorials visit : ns lectures youtube channel
3. Multi-Valued Attributes
Example Diagram:
As we can see in the above example, the Student entity has four attributes: Roll_no and Age
are simple as well as single-valued attributes as discussed above
but Mob_no and Email_id are represented by co-centric ellipse are multi-valued
attributes. Each student in the real world can provide more than one email-id as well as a
mobile contact number, and therefore, we need these attributes to be multi-valued so that they
can store multiple values at a time for an entity instance.
4. Derived Attributes
Derived attributes in DBMS are those attributes whose values can be derived from
the values of other attributes. They are always dependent upon other attributes for
their value.
Example Diagram:
5. Key Attributes
Key attributes are special types of attributes that act as the primary key for an entity
and they can uniquely identify an entity from an entity set. The values that key
attributes store must be unique and non-repeating.
Example Diagram:
As we can see in the above example, we can say that the Roll_no attribute of the
Student entity is not only simple and single-valued attribute but also, a key valued
attribute as well. Roll_no of a student will always be unique to identify the student. Also
note that the Gender and Age of two or more persons can be same and overlapping in
nature and obviously, we can't identify a student on the basis of them.
Hence, gender and age are not key-valued attributes.
6. Complex Attributes
The complex attribute in DBMS involves both multivalued and composite attributes.
For example, someone might have more than one house, and each house might
have more than one phone. The phone is then considered a complex attribute.
In the example above, the phone number is a composite attribute of the area code,
exchange, and line number. Complex attributes are often used in database design
to represent relationships between entities. Here is a complex attribute example
explained in the form of a diagram.
Attribute set:
Entity-Relationship Set
A set of relationships of the same type is known as a relationship set. The following
relationship set depicts S1 as enrolled in C2, S2 as enrolled in C1, and S3 as
registered in C3.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Relationship Set
On the basis of degree of a relationship set, a relationship set can be classified into
the following types-
1. Unary relationship set
2. Binary relationship set
3. Ternary relationship set
4. N-ary relationship set
The number of different entity sets participating in a relationship set is called the
degree of a relationship set.
1. Unary Relationship: When there is only ONE entity set participating in a relation,
the relationship is called a unary relationship. For example, one person is married to
only one person.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Fig-Unary Relationship
2. Binary Relationship:When there are TWO entities set participating in a
relationship, the relationship is called a binary relationship. For example, a Student is
enrolled in a Course.
Ternary relationship set is a relationship set where three entity sets participate in a
relationship set.
Example-
4. n-ary Relationship: When there are n entities set participating in a relation, the
relationship is called an n-ary relationship.
Cardinality Constraints
Constraints are used for modeling limitations on the relations between
entities.
There are two types of constraints on the Entity Relationship (ER) model −
Mapping cardinality or cardinality ratio.
Participation constraints.
Mapping Cardinality
For complete DBMS subject tutorials visit : ns lectures youtube channel
One-to-One Cardinality
Using Sets, it can be represented as:
3. Many-to-One:When entities in one entity set can take part only once in the
relationship set and entities in other entity sets can take part more than once in the
relationship set, cardinality is many to one. Let us assume that a student can take
only one course but one course can be taken by many students. So the cardinality
will be n to 1. It means that for one course there can be n students but for one
student, there will be only one course.
The total number of tables that can be used in this is 3.
Many-to-One Cardinality
Using Sets, it can be represented as:
For complete DBMS subject tutorials visit : ns lectures youtube channel
Many-to-Many Cardinality:
Using Sets, it can be represented as:
2. Participation Constraints:
In a Relationship, Participation constraint specifies the presence of an entity when it
is related to another entity in a relationship type. It is also called the minimum
cardinality constraint.
It specifies that each entity present in the entity set must mandatorily
participate in at least one relationship instance of that relationship
set,for this reason, it is also called as mandatory participation
It is represented using a double line between the entity set and relationship
set
It specifies that each student must be enrolled in at least one course where
the “student” is the entity set and relationship “enrolled in” signifies total
participation .It means that every student must have enrolled at least in one
course
For complete DBMS subject tutorials visit : ns lectures youtube channel
Partial participation
It specifies that each entity in the entity set may or may not participate in
the relationship instance of the relationship set, is also called as optional
participation
It is represented using a single line between the entity set and relationship
set in the ER diagram
Entity Constraints
Attribute Constraints
I. Entity Constraints:
These constraints define the rules for creating instances of an entity. There are
two types of entity constraints:
1. Key Constraints:
2. Participation Constraint
1. key Constraints:
This constraint ensures that each instance of an entity has a unique identifier, which
is called a primary key. This means that no two instances of the entity can have the
same primary key value.The entity key constraint states that primary key value can't
be null.This is because the primary key value is used to identify individual rows in
relation and if the primary key has a null value, then we can't identify those rows.
A table can contain a null value other than the primary key field.
Example:
2. Participation Constraints:
In a Relationship, Participation constraint specifies the presence of an entity when it
is related to another entity in a relationship type. It is also called the minimum
cardinality constraint.
1) Domain Constraints: This constraint specifies the set of valid values that an
attribute can have.
o The data type of domain includes string, character, integer, time, date,
currency, etc. The value of the attribute must be available in the
corresponding domain.
Example:
2) Key Constraints: This constraint ensures that each instance of an attribute has a
unique identifier, which is called a primary key. This means that no two instances of
the attribute can have the same primary key value.
1) Cardinality Constraints:
This constraint specifies the number of instances of one entity that can be related to
the number of instances of another entity. There are four types of cardinality
constraints: one-to-one, one-to-many, many-to-one, and many-to-many.
2) Participation Constraints:
In a Relationship, Participation constraint specifies the presence of an entity when it
is related to another entity in a relationship type. It is also called the minimum
cardinality constraint.
The very first step is identifying all the Entities, and place them in a Rectangle,
and labelling them accordingly.
The next step is to identify the relationship between them and pace them
accordingly using the Diamond, and make sure that, Relationships are not
connected to each other.
Attach attributes to the entities properly.
Remove redundant entities and relationships.
Add proper colours to highlight the data present in the database.
1. 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 in which two or
more entities can be generalized to a higher level entity if they have some attributes
in common. 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).
For complete DBMS subject tutorials visit : ns lectures youtube channel
Example-2 of Generalization –
Consider two entities Student and Patient. These two entities will have some
characteristics of their own. For example Student entity will have Roll_No, Name and
Mob_No while patient will have PId, Name and Mob_No characteristics. Now in this
example Name and Mob_No of both Student and Patient can be combined as a
Person to form one higher level entity and this process is called as Generalization
Process.
Example-2:
Consider an entity Account. This will have some attributes consider them Acc_No
and Balance. Account entity may have some other attributes like Current_Acc and
Savings_Acc. Now Current_Acc may have Acc_No, Balance and Transactions while
Savings_Acc may have Acc_No, Balance and Interest_Rate henceforth we can say
that specialized entities inherits characteristics of higher level entity.
After applying generalization and specialization, the structure of resultant figures are
same
GENERALIZATION SPECIALIZATION
or more lower-level entity sets to subset of a higher level entity set to form a
produce a higher-level entity sets. lower-level entity set.
There is no inheritance in
There is inheritance in Specialization.
Generalization.
3. Aggregation:
Aggregation in DBMS (Database Management System) is the process of combining
two or more entities to form a more meaningful new entity. When the entities do not
make sense on their own, the aggregation process is used. A relationship is
established and the resulting product is created into a new entity in order to create
aggregation between two entities that cannot be used for their individual qualities.
The relationship can be of any type, such as SUM, AVG, AND, OR, and so on.
Aggregation on tables can be done with a variety of tools available on the market.
When using numerical values as data, the following operations can be used to
perform DBMS aggregation:
AVG: This function returns the mean or average of the data values.
Sum: After the data values have been added, this function returns a total
value.
Count: This field returns the number of records.
Maximum (Max): This function returns the greatest value from a given set of
data.
Minimum (Min): This function returns the smallest value in a given set of
data.
We will use the simple ER model described above. There are three entities in the
diagram above: patient history, doctor, and patient. Filing and diagnosis are
examples of relationships. The patient is diagnosed by the doctor.
The database stores information about this diagnosis as well as any other patient
information. Filing is required to make it easier for the doctor to retrieve the patient’s
information in the future. In this case, the patient is unable to work alone. To get a
diagnosis, he needs to build a relationship with the doctor. A diagnosis cannot be
made by the doctor without the presence of the patient. In the future, the doctor will
need information about the patient’s history, which he will have to gather from a filing
system.
The final entity (the patient’s history) ensures that the system as a whole is
operational. Without a doctor’s diagnosis and a filing system, obtaining the patient’s
history is impossible.
example-3:
Generalization is the
process of defining a higher-
Specialization is the Aggregation is the process of
level entity that
process of defining one combining two or more entities
encompasses two or more
or more sub-entities from into a single entity.
lower-level entities that
a single entity.
share common attributes or
characteristics.
The purpose of
The purpose of
specialization is to divide
generalization is to simplify The purpose of aggregation is to
a more generic entity into
the database structure by combine entities into a higher-
more specific entities that
grouping similar entities into level concept.
have unique attributes or
a more generic entity.
characteristics.
An example of
An example of
generalization in an
specialization in the same An example of aggregation in the
employee database is to
database would be to same database would be to
define a more generic entity
divide the "employee" combine the "department" entity
called "employee" that
entity into sub-entities and the "employee" entity into a
includes all types of
such as new entity called "department-
employees such as
"manager,""clerk," and employee."
managers, clerks, and
"executive."
executives.
Generalization, Specialization example:
For complete DBMS subject tutorials visit : ns lectures youtube channel
Class hierarchy:
the concepts of Generalization, Specialization and Aggregation are the class
hierarchies of “is a” relationship.
For complete DBMS subject tutorials visit : ns lectures youtube channel
Example:
Before you create any table inside database at first you need to use that database ,
so that whatever the table you create, that table will be stored in that particular
database.
Syntax:
Use database_name;
Example:
Use college;
syntax:
Example:
The DBMS provides specific database languages that enable users to express their
needs to update or retrieve data. One popular example is SQL, which is widely used
as the standard programming language for many databases.
For complete DBMS subject tutorials visit : ns lectures youtube channel
DDL statements are used to perform various actions, such as creating new objects in
the database, altering existing objects, deleting objects, or renaming them.
a) CREATE: It is used to create new objects in the database, like tables, indexes, or
columns.
column1 datatype,
column2 datatype,
...
);
Example:
rollno INT,
name VARCHAR(50),
For complete DBMS subject tutorials visit : ns lectures youtube channel
age INT
);
Example:
Example:
Example:
Example:
Example:
Example:
e) RENAME: The RENAME statement in DDL allows you to change the name of an
existing table.
Example:
a) INSERT: The INSERT statement is used to add new data into an existing
database table. It allows users to insert new records or rows with specified values
into the table.
Syntax:
commit;
Example:
start transaction;
use college;
create table if not exists students(name text, rollno int primary key);
For complete DBMS subject tutorials visit : ns lectures youtube channel
commit;
commit;
In the above example after creating table with name students and inserting data in
my table I written ‘ commit’, only if I write commit, even if I close my application(
mysql software) , my table and data will be permanently stored in my database. Or
else if you don’t use “commit” data will be permanently deleted once if you close
application
Syntax: rollback;
Example:
start transaction;
use college;
create table if not exists students(name text, rollno int primary key);
rollback;
note:
rollback will undo above transaction i.e.., it will not create table
Certainly! Here are simplified syntax examples for the GRANT and REVOKE
commands in SQL:
For complete DBMS subject tutorials visit : ns lectures youtube channel
a) GRANT Command:
b) REVOKE Command:
an tagvéaotien or
modled as
Sheuldo (ontapt e
ternory velotonShip 2
entySets:
Atbute
a tbute
whle icentying he
whety a propeihy
t Sornarbrnas ot cleov
of o
radesed
mdeed a on acttibute
Cons de adling
an
errtty Set to etompde
addrs iotmatiro othe y enbty Ct
e oddak al an attibute
eing an Atnbute:
va abte we naedb vetord
my One
ddossG allva: kydevabad) per
employo
cees
vnpp (Crlane)
Mploy4
ng htty
Epays. Ho Addren
et V Yelohomskip
GnaabpetDPe
manoges Deportrrut
St (onstste Ttultos ondi
he en
afsorlate eloenp DYXornple
ith
a odatee with
alocatec
eb tie
enbstie
ond epostrmant oha me
ploye
yployee
dah otheh
manoged yekonSksp.
w
w i th
h
is oocioleed
O4Socottd
elhonSp
o Managas
noal th empley
manegoY beCat
Con (reobe
will
mamge buelgeE So we
n Stead relationskhp
monage an
er TA kep
staish
nd we nded
enbte
nd
manage y
poyee
ermplunryes
ASA
ncr
Dpld p t r o
Singd b u k
fortment
monaq
ina Ve n elahoSp
nachu
Yelshonskips Searns
Agh biney
Senehenos
in caltty it
ertbes
neces Souy to Cooneet hvee oore
ernyelaenSps eguwred
whn
ino veehorSkpe
Tor example
h a aa bole r a Connpon
uppose y
PRODUC
artank he tst hy
might be
SupPER he uyelaionSkps might be
PRopu SorPER we ta lompan
pctssocoapphertt a
Pracbets
rom
PRODUct/SuPPuER ishlessle.prs
Splitnem o
Sppler
wesprte
enti ad hat
USTOMER PAoDUdelshmSkp
( Yetal-Pie
ternon, Yelahionsp'
inqye
(onside C A4*na C nano
o Surphra utoma
pyodw
Procuut bosed on a
i e , So insttsd
Suphevd-predut nd (utumas
Splie-(hm hotwi ho
intr'section Aue piaCPp
( PAa
Podu
Suppe
o d u t i ( P r o s u u t - r e r r e
(ustver id
For complete DBMS subject tutorials visit : ns lectures youtube channel
1. ER Diagram of Company
For complete DBMS subject tutorials visit : ns lectures youtube channel
This bank ER diagram illustrates key information about bank, including entities such
as branches, customers, accounts, and loans. It allows us to understand the
relationships between entities.
Entities and their Attributes are :
Bank Entity : Attributes of Bank Entity are Bank Name, Code and Address.
Code is Primary Key for Bank Entity.
Customer Entity : Attributes of Customer Entity are Customer_id, Name, Phone
Number and Address.
Customer_id is Primary Key for Customer Entity.
Branch Entity : Attributes of Branch Entity are Branch_id, Name and Address.
Branch_id is Primary Key for Branch Entity.
Account Entity : Attributes of Account Entity are Account_number,
Account_Type and Balance.
Account_number is Primary Key for Account Entity.
Loan Entity : Attributes of Loan Entity are Loan_id, Loan_Type and Amount.
Loan_id is Primary Key for Loan Entity.
Relationships are :
.
For complete DBMS subject tutorials visit : ns lectures youtube channel
UNIT-1
IMPORTANT QUESTIONS
1. What is database and DBMS?
2. Explain Characteristics/ features, Database tasks, Advantages, Disadvantages,
Applications, history of DBMS?
3. Explain Difference between file system and DBMS?
4. Explain Various Data Models in DBMS? (Hint :- Hierarchical Model, Network Model,
Entity-Relationship Model, Relational Model, Object-Oriented Data Model, Object-Relational
Data Model, Flat Data Model , Semi-Structured Data Model)
5. What is Schema and Data Abstraction in DBMS?
6. What are various Levels of abstraction for DBMS (or) three levels of the schema (or) Three
tier schema Architecture ?
7. What is Data Independence ? Explain Difference between Physical and Logical data
independence ?
8. What is an instance ?
9. Explain DBMS Architecture and types of DBMS Architectures ?( hint: 1- tier, 2- tier, 3- tier )
10. Explain Database System architecture and various components we use in this database
system architecture in detail.
11. What are Six steps of Database design process and which steps are relevant to ER model?
12. Why Use ER Diagrams In DBMS? Various Symbols Used in ER Model and The components
/features of an ER diagram?
13. Explain entities and types of entities, entity set , attributes and types of attributes,
relationship, relationship set, Degree of a Relationship Set (or) Types of Relationship Sets?
14. What are Cardinality Constraints? types of constraints on the Entity Relationship (ER)
model?(hint :- Mapping cardinality or cardinality ratio, Participation constraints)
15. Explain various types of constraints In an Entity-Relationship (ER) model?
16. Generalization, Specialization and Aggregation in ER Model with an examples?
17. What is Class hierarchy? Define SQL? Explain how to convert ER Model to a Relational Model
with an example?
18. What are Database Languages (or) query languages (or) data query languages (or) sql
languages? ( hint: DDL, DML, DCL, TCL )
19. Explain Difference between entity and Attribute, Entity set vs Relationship set, Binary vs
ternary relationship
20. Draw ER Diagram for
a) Company
b) Library Management System
c) online Shopping
d) hospital management system
e) University management system
f) hotel management system
g) Bank management system
h) Railway reservation system
i) Car Rental system
j) Car insurance company