Unit 1
Unit 1
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.
Database architecture can be seen as a single tier or multi-tier. But logically, database
architecture is of two types like: 2-tier architecture and 3-tier architecture.
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 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.
Components of DBMS
DBMS stands for DataBase Management System. DBMS is a type of software by which
we can save and retrieve the user's data with the security process. DBMS can manipulate
the database with the help of a group of programs. The DBMS can accept the request
from the operating system to supply the data. The DBMS also can accept the request to
retrieve a large amount of data through the user and third-party software.
DBMS also give permission to the user to use the data according to their needs. The
word "DBMS" contains information regarding the database program and the users. It
also provides an interface between the user and the software. In this topic, we are going
to discuss the various types of DBMS.
Components of DBMS
There are many components available in the DBMS. Each component has a significant
task in the DBMS. A database environment is a collection of components that regulates
the use of data, management, and a group of data. These components consist of
people, the technique of Handel the database, data, hardware, software, etc. there are
several components available for the DBMS. We are going to explain five main topics of
the database below.
1. Hardware
o Here the hardware means the physical part of the DBMS. Here the hardware
includes output devices like a printer, monitor, etc., and storage devices like a
hard disk.
o In DBMS, information hardware is the most important visible part. The equipment
which is used for the visibility of the data is the printer, computer, scanner, etc.
This equipment is used to capture the data and present the output to the user.
o With the help of hardware, the DBMS can access and update the database.
o The server can store a large amount of data, which can be shared with the help of
the user's own system.
o The database can be run in any system that ranges from microcomputers to
mainframe computers. And this database also provides an interface between the
real worlds to the database.
o When we try to run any database software like MySQL, we can type any
commands with the help of our keyboards, and RAM, ROM, and processor are
part of our computer system.
2. Software
3. Data
o The term data means the collection of any raw fact stored in the database. Here
the data are any type of raw material from which meaningful information is
generated.
o The database can store any form of data, such as structural data, non-structural
data, and logical data.
o The structured data are highly specific in the database and have a structured
format. But in the case of non-structural data, it is a collection of different types
of data, and these data are stored in their native format.
o We also call the database the structure of the DBMS. With the help of the
database, we can create and construct the DBMS. After the creation of the
database, we can create, access, and update that database.
o The main reason behind discovering the database is to create and manage the
data within the database.
o Data is the most important part of the DBMS. Here the database contains the
actual data and metadata. Here metadata means data about data.
o For example, when the user stores the data in a database, some data, such as the
size of the data, the name of the data, and some data related to the user, are
stored within the database. These data are called metadata.
4. Procedures
o The procedure is a type of general instruction or guidelines for the use of DBMS.
This instruction includes how to set up the database, how to install the database,
how to log in and log out of the database, how to manage the database, how to
take a backup of the database, and how to generate the report of the database.
o In DBMS, with the help of procedure, we can validate the data, control the access
and reduce the traffic between the server and the clients. The DBMS can offer
better performance to extensive or complex business logic when the user follows
all the procedures correctly.
o The main purpose of the procedure is to guide the user during the management
and operation of the database.
o The procedure of the databases is so similar to the function of the database. The
major difference between the database procedure and database function is that
the database function acts the same as the SQL statement. In contrast, the
database procedure is invoked using the CALL statement of the DBMS.
o Database procedures can be created in two ways in enterprise architecture. These
two ways are as below.
o The individual object or the default object.
o The operations in a container.
2. <Datatype>,...)
3. IS
4. Declaration section<variable, constant> ;
5. BEGIN
6. Execution section
7. EXCEPTION
8. Exception section
9. END
o ALTER<object>
o COMMENT
o CREATE<object>
o DESCRIBE<object>
o DROP<object>
o SHOW<object>
o USE<object>
The following commands serve as the base for all DML commands:
o INSERT
o UPDATE
o DELETE
o LOCK
o CALL
o EXPLAIN PLAN
6. People
o The people who control and manage the databases and perform different types
of operations on the database in the DBMS.
o The people include database administrator, software developer, and End-user.
o Database administrator-database administrator is the one who manages the
complete database management system. DBA takes care of the security of the
DBMS, its availability, managing the license keys, managing user accounts and
access, etc.
o Software developer- theThis user group is involved in developing and designing
the parts of DBMS. They can handle massive quantities of data, modify and edit
databases, design and develop new databases, and troubleshoot database issues.
o End user - These days, all modern web or mobile applications store user data.
How do you think they do it? Yes, applications are programmed in such a way
that they collect user data and store the data on a DBMS system running on their
server. End users are the ones who store, retrieve, update and delete data.
o The users of the database can be classified into different groups.
i. Native Users
ii. Online Users
iii. Sophisticated Users
iv. Specialized Users
v. Application Users
vi. DBA - Database Administrator
2. Database Design:
The second phase focuses on the design of the database model that will support company
operations and objectives. This is arguably the most critical DBLC phase: making sure that
the final product meets user and system requirements. As you examine the procedures
required to complete the design phase in the DBLC, remember these points:
• The process of database design is loosely related to the analysis and design of a larger
system. The data component is only one element of a larger information system.
• The systems analysts or systems programmers are in charge of designing the other
system components. Their activities create the procedures that will help transform the data
within the database into useful information.
In the design phase, decisions were made to ensure integrity, security, performance, and
recoverability of the database. During implementation and loading, these plans were put
into place. In testing and evaluation, the DBA tests and fine-tunes the database to ensure
that it performs as expected. This phase occurs in conjunction with applications
programming.
a. Test the Database:
During this step, the DBA tests the database to ensure that it maintains the integrity
and security of the data. Data integrity is enforced by the DBMS through the proper use
of primary and foreign key rules. In database testing you must check Physical security
allows, Password security, Access rights, Data encryption etc.
b. Fine-Tune the Database:
Although database performance can be difficult to evaluate because there are no
standards for database performance measures, it is typically one of the most important
factors in database implementation. Different systems will place different performance
requirements on the database. Many factors can impact the database’s performance on
various tasks. Environmental factors, such as the hardware and software environment
in which the database exists, can have a significant impact on database performance.
c. Evaluate the Database and Its Application Programs:
As the database and application programs are created and tested, the system must also
be evaluated from a more holistic approach. Testing and evaluation of the individual
components should culminate in a variety of broader system tests to ensure that all of
the components interact properly to meet the needs of the users. To ensure that the
data contained in the database are protected against loss, backup and recovery plans
are tested.
5. Operation
Once the database has passed the evaluation stage, it is considered to be operational. At
that point, the database, its management, its users, and its application programs constitute
a complete information system. The beginning of the operational phase invariably starts
the process of system evolution.
There are three stages in data modeling: conceptual, logical, and physical. Each stage brings the
database closer to reality.
The conceptual model sketches out the entities to be represented and determines what kinds of
relationships exist between them. It deals with the scope of the database to be created and defines the
general rules that need to be considered.
The logical model will take these entities a step further and work out the details of how their attributes
and relationships. It defines the structure, but does not concern itself with the technical aspects of how
the database will be constructed.
The physical model moves from abstraction to reality and considers the database management
technology to be used, the design of the tables that will make up the actual database, and the keys that
will represent the relationships between these tables.
The conceptual data model gives the designer the chance to gain an overview of the system to be
designed without being concerned with the details of how it will be implemented. Conceptual data
models can be very quick to create, but they can also rapidly highlight faulty assumptions and potential
problems. The conceptual model is a simplified diagram of the final database, with the details
deliberately ignored so that the big picture can be understood.
Entity-relationship models are one of the most popular ways to create a quick and clear conceptual data
model. An ER model consists of entities, attributes, and relationships.
1. Entities
The real-world elements in the system are defined first. Entities can be concepts, events, objects,
persons, companies, or systems. If a thing can be identified as discrete, then it can be an entity.
2. Attributes
The characteristics that differentiate the entity from other entities are its attributes. These can be
anything that defines the entity, such as name, category, ID, date of creation, or description. The types
of attributes will depend on the type of system being created.
3. Relationships
Each entity in a database has some sort of relationship with the other entities. They may be related
because they interact with each other, or they may be dependent on each other, or have a parent-child
relationship, with inheritance of attributes. Whatever the relationship, it needs to be explained and
represented during the process of data modeling.
4. Normalization
Database normalization is based on removing ambiguities from relationships and removing repetition or
redundancy. This is carried out by reviewing the various primary, secondary, or foreign keys associated
with each entity.
5. Validation
This phase is hopefully when it all comes together, with the rules, formats, requirements, and syntax
being checked, along with the entities, relationships and keys. If changes are needed, the designer goes
over the model again to refine it.
When to use foreign keys: Foreign keys act like primary keys in that they are also used to identify
specific entries in tuples, but foreign keys always reference another table. Tables with foreign keys are
called ‘child tables’, because they always link back to a table with a primary KEY.
ER Model
The Entity Relational Model is a model for identifying entities to be represented
in the database and representation of how those entities are related. The ER
data model specifies enterprise schema that represents the overall logical
structure of a database graphically.
The Entity Relationship Diagram explains the relationship among the entities
present in the database. ER models are used to model real-world objects like a
person, a car, or a company and the relation between these real-world objects.
In short, the ER Diagram is the structural format of the database.
Why Use ER Diagrams In DBMS?
ER diagrams are used to represent the E-R model in a database, which
makes them easy to be converted into relations (tables).
ER diagrams provide the purpose of real-world modeling of objects which
makes them intently useful.
ER diagrams require no technical knowledge and no hardware support.
These diagrams are very easy to understand and easy to create even for a
naive user.
It gives a standard solution for visualizing the data logically.
Symbols Used in ER Model
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 the ER Model.
Ellipses: Ellipses represent Attributes in the 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.
Components of ER Diagram
ER Model consists of Entities, Attributes, and Relationships among Entities in a
Database System.
Entity
An Entity may be an object with a physical existence – a particular person, car,
house, or employee – or it may be an object with a conceptual existence – a
company, a job, or a university course.
Entity Set: An Entity is an object of Entity Type and a set of all entities is called
an entity set. For Example, E1 is an entity having Entity Type Student and the
set of all students is called Entity Set. In ER diagram, Entity Type is represented
as:
1. Strong Entity
A Strong Entity is a type of entity that has a key Attribute. Strong Entity does not
depend on other Entity in the Schema. It has a primary key, that helps in
identifying it uniquely, and it is represented by a rectangle. These are called
Strong Entity Types.
2. Weak Entity
An Entity type has a key attribute that uniquely identifies each entity in the entity
set. But some entity type exists for which key attributes can’t be defined. These
are called Weak Entity types.
Attributes
Attributes are the properties that define the entity type. For example, Roll_No,
Name, DOB, Age, Address, and Mobile_No are the attributes that define entity
type Student. In ER diagram, the attribute is represented by an oval.
1. Key Attribute
The attribute which uniquely identifies each entity in the entity set is called
the key attribute. For example, Roll_No will be unique for each student. In ER
diagram, the key attribute is represented by an oval with underlying lines.
2. Composite Attribute
An attribute composed of many other attributes is called a composite
attribute. For example, the Address attribute of the student Entity type consists
of Street, City, State, and Country. In ER diagram, the composite attribute is
represented by an oval comprising of ovals.
3. Multivalued Attribute
An attribute consisting of more than one value for a given entity. For example, Phone_No
(can be more than one for a given student). In ER diagram, a multivalued attribute is
represented by a double oval.
4. Derived Attribute
An attribute that can be derived from other attributes of the entity type is known
as a derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, the
derived attribute is represented by a dashed oval.
The Complete Entity Type Student with its Attributes can be represented as:
Unary Relationship
Binary Relationship
3. n-ary Relationship: When there are n entities set participating in a relation,
the relationship is called an n-ary relationship.
Cardinality
The number of times an entity of an entity set participates in a relationship set is
known as cardinality. Cardinality can be of different types:
1. One-to-One: When each entity in each entity set can take part only once in
the relationship, the cardinality is one-to-one. Let us assume that a male can
marry one female and a female can marry one male. So the relationship will be
one-to-one.
the total number of tables that can be used in this is 2.
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.
In this case, each student is taking only 1 course but 1 course has been taken
by many students.
4. Many-to-Many: When entities in all entity sets can take part more than once
in the relationship cardinality is many to many. Let us assume that a student
can take more than one course and one course can be taken by many students.
So the relationship will be many to many.
the total number of tables that can be used in this is 3.
Participation Constraint
Participation Constraint is applied to the entity participating in the relationship
set.
1. Total Participation – Each entity in the entity set must participate in the
relationship. If each student must enroll in a course, the participation of
students will be total. Total participation is shown by a double line in the ER
diagram.
2. Partial Participation – The entity in the entity set may or may NOT
participate in the relationship. If some courses are not enrolled by any of the
students, the participation in the course will be partial.
The diagram depicts the ‘Enrolled in’ relationship set with Student Entity set
having total participation and Course Entity set having partial participation.
Every student in the Student Entity set participates in a relationship but there
exists a course C4 that is not taking part in the relationship.
Enhanced ER Model(EER Modeling)
Today the complexity of the data is increasing so it becomes more and more
difficult to use the traditional ER model for database modeling. To reduce this
complexity of modeling we have to make improvements or enhancements to the
existing ER model to make it able to handle the complex application in a better
way.
Enhanced entity-relationship diagrams are advanced database diagrams very
similar to regular ER diagrams which represent the requirements and
complexities of complex databases.
It is a diagrammatic technique for displaying the Sub Class and Super Class;
Specialization and Generalization; Union or Category; Aggregation etc.
Super class shape has sub groups: Triangle, Square and Circle.
Sub classes are the group of entities with some unique attributes. Sub class
inherits the properties and attributes from super class.
It is a Bottom up process i.e. consider we have 3 sub entities Car, Truck and
Motorcycle. Now these three entities can be generalized into one super class
named as Vehicle.
These are two normal kinds of relationships that were added to the normal ER model for
enhancement. These are inspired by the object-oriented paradigm, where we divide the
code into classes and objects, and in the same way, we have divided entities into
subclass and superclasses. Specialized classes are called subclasses, and generalized
classes are called superclasses or base classes. We can learn the concept of subclass by
'IS-A' analysis. For example, 'Laptop IS-A computer.' Or 'Clerk IS-A employee.'
In this relationship, one entity is a subclass or superclass of another entity. For example,
in a university, a faculty member or clerk is a specialized class of employees. So an
employee is a generalized class, and all others are its subclass.
We can draw the ER diagram for these relationships. Let's suppose we have a superclass
Employee and subclasses as a clerk, engineer, and lab assistant.
The Enhanced ER diagram of the above example will look like this:
In the above example, we have one superclass and three subclasses. Each subclass
inherits all the attributes from its superclass so that a lab assistant will have all its
attributes, like its name, salary, etc.
Constraints
There are two types of constraints on subclasses which are described below:
o Total or Partial:
A total subclass relationship is one where the union of all the subclasses is equal to the
superclass. It means if every superclass entity has some subclass entity, then it is called a
total subclass relationship. Let's suppose if the union of all the subclasses ( engineer,
clerk, lab assistant) is equal to the total employee. Then the relationship is total. In the
above example, it is a total relationship.
If all the entities of a superclass are not associated with a subclass, then it is called a
partial subclass relationship.
o Overlapped or Disjoint:
If any entity from the superclass is associated with more than one subclass, then it is
known as overlapped subclassing, and if it is associated with zero or only one subclass,
then it is called disjoint subclassing.
Multiple Inheritance
When one subclass is associated with more than one superclass, then this phenomenon
is known as multiple inheritance. In multiple inheritance, the attributes of the subclass
will be the union of all the superclass attributes which are associated with it. For
example, a teacher is a subclass that can be associated with the superclass of an
employee and a superclass of faculty. In the same way, a monitor in the class can be a
subclass of a student superclass as well as an alumni superclass.
UNION
UNION is a different topic from subclassing. Let's suppose we have a vehicle superclass,
and we have two subclasses, car and bike. These two subclasses will inherit the
attributes from the vehicle superclass.
Now we have a UNION of those vehicles which are RTO registered, so we have a UNION
of cars and bikes, but they will inherit all the attributes from the vehicle superclass.
Union
Relationship of one super or sub class with more than one super class.
Aggregation
Represents relationship between a whole object and its component.
Consider a ternary relationship Works_On between Employee, Branch and
Manager. Now the best way to model this situation is to use aggregation, So,
the relationship-set, Works_On is a higher level entity-set. Such an entity-set is
treated in the same manner as any other entity-set. We can create a binary
relationship, Manager, between Works_On and Manager to represent who
manages what tasks.
Complex DataModel Relationship
Additionally, it can be helpful to speak with subject matter experts and data
stakeholders to gain a deeper understanding of the data and its implications for the
organization. By fully understanding the data model and how it relates to the
organization's goals and processes, it is easier to identify areas for simplification and
improvement.
Data models are essential to organize complex data systems. However, as data
systems grow, data models tend to become more complicated. Simplifying data
models is vital since it helps to improve efficiency, speed, and accuracy of data
processing. A complex data model may have redundant fields, duplicate data
records, and obscure relationships, which may lead to confusion, errors, and
inconsistencies. Simplifying data models enables users to focus on core data
elements, identify meaningful relationships, and access necessary information
quickly. It also makes the maintenance, testing, and reporting of data more
straightforward.
Simplification of data models requires a systematic approach, including
identifying key data elements, organizing data into categories or classes, defining
relationships between categories, and eliminating redundant data. In some
cases, it may require eliminating data duplication, improving naming conventions,
and simplifying data hierarchies. The use of data modeling software, entity-
relationship diagrams, and automated data mapping tools can help simplify data
models.
It is essential to involve stakeholders in the data modeling process to ensure that
the data model reflects the business needs of the organization. Regularly
reviewing and updating the data model and documenting changes are critical
practices to maintain the integrity of the data model. Testing data model changes
before implementation can prevent errors and inconsistencies.
In summary, simplifying data models is a critical process in data management
that enables organizations to improve efficiency, accuracy, and speed in data
processing. The use of best practices, tools, involvement of stakeholders, and
regular review and updating are all essential steps to simplify data models
effectively.
Steps to Simplify Complex Data Models
Sort the data elements into groups that share common characteristics or
attributes.
Label the categories in a meaningful and descriptive way.
Remove any data elements that do not fit into any category.
Consider the relationships between categories and rearrange them as
necessary.
Use subcategories to further group related data elements.
Keep the number of categories to a minimum for ease of understanding.
Make sure the categories accurately represent the scope and purpose of the
data model.
Apply consistent rules and standards for categorizing data elements across
different models and projects.
By organizing data elements into categories, you can create a clear and logical
structure for your data model. This makes it easier to understand and use by
stakeholders and helps to avoid errors and redundancies.
Be sure to regularly review and update the relationships to ensure that they accurately
reflect the data model.
Data hierarchies refer to how data elements are grouped and structured in a
model.
To simplify data hierarchies, start by identifying the key data elements and
organizing them into categories or groups.
Eliminate any redundant categories or groups that do not add value to the model.
Refine the remaining categories and groups to have clear and distinct
relationships between them.
Avoid creating too many levels in the hierarchy, as this can lead to confusion and
complexity.
The goal of simplifying data hierarchies is to improve the clarity and usability of
the data model for all users.
Entity-Relationship Diagrams
An Entity-Relationship Diagram (ERD) is a graphical representation of the entities and
their relationships to each other in a database system. It is used to define the data
schema, which includes the organization and structure of the data, as well as the
relationships and constraints that exist between data elements.
The entities in an ERD represent the objects or concepts that exist in the system being
modeled, such as customer, product, order, etc. The relationships between these
entities capture the associations and dependencies that exist between them, such as a
customer placing an order or a product being part of an order.
ERDs use three basic elements to represent the entities, relationships, and attributes of
a database system. These elements are:
ERDs are useful in simplifying complex data models by visualizing the relationships
between entities. They can also help in identifying redundant data and improving the
efficiency of the data storage. ERDs are widely used in the software development
industry and are an essential tool for designing a database schema that meets the
needs of the organization.
Overall, ERDs provide a clear and concise overview of the data schema in a database
system. They are an invaluable asset for database designers, developers, and
stakeholders in the data modeling process.
Assessing whether the data model meets current and future business needs.
Identifying any new data elements or categories that need to be added.
Removing any outdated or irrelevant elements.
Checking that relationships between categories still make sense.
Testing that changes to the data model don't break existing systems or
processes.
Updating documentation to reflect any changes.
Communicating any changes to stakeholders who may be affected by them.
Encouraging feedback on the changes made to continually improve the data
model.
For example, we can create and represent a ternary relation ship 'parent' that may relate to a
child, his father, as well as his mother. Such relationship can also be represented by two binary
relationships i.e, mother and father, that may relate to their child. Thus, it is possible to
represent a non-binary relationship by a set of distinct binary relationships.
4. Placing Relationship Attributes
The cardinality ratio of a relationship can affect the placement of relationship attributes:
• One-to-Many: Attributes of 1:M relationship set can be repositioned to only the entity set on the
many side of the relationship
• One-to-One: The relationship attribute can be associated with either one of the participating
entities
• Many-to-Many: Here, the relationship attributes can not be represented to the entity sets;
rather they will be represented by the entity set to be created for the relationship set