DBMS Unit-I
DBMS Unit-I
The database is a collection of inter-related data which is used to retrieve, insert and delete the data efficiently.
It is also used to organize the data in the form of a table, schema, views, and reports, etc.
For example: The college Database organizes the data about the admin, staff, students and faculty etc.
Data Definition: It is used for creation, modification, and removal of definition that defines the organization
of data in the database.
Data Updation: It is used for the insertion, modification, and deletion of the actual data in the database.
Data Retrieval: It is used to retrieve the data from the database which can be used by applications for
various purposes.
User Administration: It is used for registering and monitoring users, maintain data integrity, enforcing data
security, dealing with concurrency control, monitoring performance and recovering information corrupted by
Characteristics of DBMS
unexpected failure.
It uses a digital repository established on a server to store and manage the information.
It can provide a clear and logical view of the process that manipulates data.
DBMS contains automatic backup and recovery procedures.
It contains ACID properties which maintain data in a healthy state in case of failure.
It can reduce the complex relationship between data.
It is used to support manipulation and processing of data.
It is used to provide security of data.
It can view the database from different viewpoints according to the requirements of the user.
Advantages of DBMS
Controls database redundancy: It can control data redundancy because it stores all the data in one single
database file and that recorded data is placed in the database.
Data sharing: In DBMS, the authorized users of an organization can share the data among multiple users.
Easily Maintenance: It can be easily maintainable due to the centralized nature of the database system.
Reduce time: It reduces development time and maintenance need.
Backup: It provides backup and recovery subsystems which create automatic backup of data from hardware
and software failures and restores the data if required.
multiple user interface: It provides different types of user interfaces like graphical user interfaces,
application program interfaces
Disadvantages of DBMS
Cost of Hardware and Software: It requires a high speed of data processor and large memory size to run
DBMS software.
Size: It occupies a large space of disks and large memory to run them efficiently.
Complexity: Database system creates additional complexity and requirements.
Higher impact of failure: Failure is highly impacted the database because in most of the organization, all
the data stored in a single database and if the database is damaged due to electric failure or database
corruption then the data may be lost forever.
Characteristics of the Database Approach
Introduction
A database is a collection of data that is organized in a specific way, making it easy to access, manage, and update. The database approach is a
method of designing and implementing a database that emphasizes the use of a specific set of characteristics to ensure that the data is
accurate, consistent, and easily accessible. In this article, we will explore the key characteristics of the database approach and how they are
used to design and implement effective databases.
Data Independence
One of the most important characteristics of the database approach is data independence. This refers to the ability to change the structure of
the database without affecting the programs that access the data. This is achieved by separating the logical and physical aspects of the
database, which allows the database administrator to make changes to the physical structure without affecting the logical structure.
For example, imagine a database that stores information about employees. The logical structure of the database may include information
such as employee name, employee ID, and employee salary. The physical structure of the database, on the other hand, may include
information such as the location of the data on disk and the specific file format used to store the data. By separating these two aspects of the
database, the database administrator can change the physical structure of the database, such as moving the data to a new disk or changing
the file format, without affecting the programs that access the data.
Data Integrity
Another important characteristic of the database approach is data integrity. This refers to the accuracy and consistency of the data in the
database. The database approach uses a variety of techniques to ensure data integrity, such as data validation, data constraints, and data
normalization.
Data validation is the process of checking the data entered into the database to ensure that it is correct and consistent. For example, if a
program is designed to input employee information into the database, the program may check that the employee ID is a unique number
and that the employee's salary is a number between $0 and $1000000.
Data constraints are used to ensure that the data in the database follows specific rules. For example, a constraint may be used to ensure
that an employee's salary is greater than $0 and less than $1000000.
Data normalization is the process of organizing the data in the database to reduce data redundancy and increase data consistency. For
example, if the database stores information about employees and departments, the data may be normalized by storing the department
information in a separate table and creating a relationship between the employee and department tables.
Data Sharing
Another important characteristic of the database approach is data sharing. This refers to the ability of multiple users to access and update the
data in the database at the same time. The database approach uses a variety of techniques to ensure data sharing, such as locking and
concurrency control.
Locking is the process of preventing other users from accessing a specific piece of data while it is being updated. For example, if a user is
updating an employee's salary, the database may lock the employee's record to prevent other users from also updating the employee's salary
at the same time.
Concurrency control is the process of managing access to the data in the database by multiple users. This can include techniques such as time
stamping, optimistic concurrency control, and pessimistic concurrency control.
Scalability
Another important characteristic of the database approach is scalability. This refers to the ability of the database to handle a large amount
of data and a large number of users without performance degradation. The database approach uses a variety of techniques to ensure
scalability, such as horizontal scaling and vertical scaling.
Horizontal scaling is the process of adding more servers to the database system to handle the increased load. This can include techniques
such as sharding, which divides the data across multiple servers, and load balancing, which distributes the load across multiple servers.
Vertical scaling is the process of adding more resources, such as memory and CPU, to a single server to handle the increased load. This can
include techniques such as upgrading the hardware or adding more CPU cores.
Security
Security is another important characteristic of the database approach, as it ensures that the data is protected from unauthorized access,
modification, or deletion. The database approach uses a variety of techniques to ensure security, such as authentication, authorization, and
encryption.
Authentication is the process of verifying the identity of a user who is trying to access the database. This can include techniques such as
username and password, or biometric authentication.
Authorization is the process of granting access to specific resources in the database based on the user's role or permissions. This can include
techniques such as access control lists or role-based access control.
Encryption is the process of converting data into a coded format that can only be read by authorized users. This can include techniques such
as symmetric key encryption or asymmetric key encryption.
Real-life example
An example of a company that utilizes the database approach is an e-commerce company. They have a database that stores customer
information, product information, and sales information. The company uses data independence to make changes to its database without
affecting the customer-facing website. They also use data integrity to ensure that customer information is accurate and consistent, and data
sharing to allow multiple customer service representatives to access and update customer information at the same time. They also use
backup and recovery to ensure that their data is safe in case of any system failures or other unexpected events.
Another example is a healthcare organization that utilizes the database approach by maintaining a patient's electronic health record (EHR)
database. The database is designed to ensure data independence, integrity, and sharing so that healthcare professionals can access and
update patients' information at the same time. They also use scalability to handle a large amount of data and a large number of users without
performance degradation, and security to protect patients' sensitive information.
Conclusion
The database approach is a method of designing and implementing databases that emphasize the use of specific characteristics to ensure
that the data is accurate, consistent, and easily accessible. These characteristics include data independence, data integrity, data sharing, and
backup and recovery. By understanding and utilizing these characteristics, organizations can design and implement effective databases that
meet their specific needs.
Entity in DBMS
In DBMS, an entity is a piece of data that is stored in the database. An entity can be a person, place,
thing, or even an event.
Entity in DBMS can be a real-world object with an existence, For example, in a College database, the
entities can be Professor, Students, Courses, etc. Entities has attributes, which can be considered as
properties describing it, for example, for Professor entity, the attributes are Professor_Name,
Professor_Address, Professor_Salary, etc. The attribute value gets stored in the database.
Strong Entity
The strong entity has a primary key. Weak entities are dependent on strong entity. Its existence is not
dependent on any other entity.
Continuing our previous example, Professor is a strong entity here, and the primary key is
Professor_ID.
Weak Entity
The weak entity in DBMS do not have a primary key and are dependent on the parent entity. It
mainly depends on other entities.
Weak Entity is represented by double rectangle.
Continuing our previous example, Professor is a strong entity, and the primary key is
Professor_ID. However, another entity is Professor_Dependents, which is our Weak Entity.
Professor_Dependents
Example of Strong and Weak Entity
The example of a strong and weak entity can be understood by the below figure.
ID is the primary key (represented with a line) and the Name in Dependent entity is
called Partial Key (represented with a dotted line).
Attribute
In DBMS, we have entities, and each entity contains some property about their behavior which is
also called the attribute. In relational databases, we have tables, and each column contains some
entity that has some attributes, so all the entries for that column should strictly follow the attribute
of the entity. Entities define the characteristic property of the attributes. For example, in a customer
database, the attributes might be name, address, and phone number. In a product database, the
attributes might be name, price, and date of manufacture.
Simple Attribute:
It is also known as atomic attributes. When an attribute cannot be divided further, then it is called a
simple attribute.
For example, in a student table, the branch attribute cannot be further divided. It is called a simple
or atomic attribute because it contains only a single value that cannot be broken further.
.
Composite Attribute:
Composite attributes are those that are made up of the composition of more than one attribute.
When any attribute can be divided further into more sub-attributes, then that attribute is called a
composite attribute.
For example, in a student table, we have attributes of student names that can be further broken
down into first name, middle name, and last name. So the student name will be a composite
attribute.
Another example from a personal detail table would be the attribute of address. The address can be
divided into a street, area, district, and state.
Single-valued Attribute:
Those attributes which can have exactly one value are known as single valued attributes. They
contain singular values, so more than one value is not allowed.
For example, the DOB of a student can be a single valued attribute. Another example is gender
because one person can have only one gender.
Multi-valued Attribute:
Those attributes which can have more than one entry or which contain more than one value are
called multi valued attributes.
In the Entity Relationship (ER) diagram, we represent the multi valued attribute by double oval
representation.
For example, one person can have more than one phone number, so that it would be a multi valued
attribute. Another example is the hobbies of a person because one can have more than one hobby.
Derived Attribute:
Derived attributes are also called stored attributes. When one attribute can be derived from the
other attribute, then it is called a derived attribute. We can do some calculations on normal
attributes and create derived attributes.
For example, the age of a student can be a derived attribute because we can get it by the DOB of
the student.
Another example can be of working experience, which can be obtained by the date of joining of an
Complex Attribute:
If any attribute has the combining property of multi values and composite attributes, then it is called a
complex attribute. It means if one attribute is made up of more than one attribute and each attribute
can have more than one value, then it is called a complex attribute.
For example, if a person has more than one office and each office has an address made from a street
number and city. So the address is a composite attribute, and offices are multi valued attributes, So
combing them is called complex attributes.
In the above example, we have an ER diagram of a table named Employee. We have a lot of
attributes from the above table.
•Department is a single valued attribute that can have only one value.
•Name is a composite attribute because it is made up of a first name and the last name as the
middle name attribute.
•Work Experience attribute is a derived attribute, and it is represented by a dotted oval. We can get
the work experience by the other attribute date of joining.
•Phone number is a multi-valued attribute because one employee can have more than one phone
ER-Diagram
ER-Diagram is a pictorial representation of data that describes how data is communicated and related
to each other. Any object, such as entities, attributes of an entity, sets of relationship, and other
attributes of relationship, can be characterized with the help of the ER diagram.
Entities: They are represented using the rectangle-shaped box. These rectangles are named with the
entity set they represent.
Student Employees Project
Entities
ER modeling is a top-down structure to database design that begins with identifying the important
data called entities and relationships in combination with the data that must be characterized in the
model. Then database model designers can add more details such as the information they want to
hold about the entities and relationships, which are the attributes and any constraints on the entities,
relationships, and attributes. ER modeling is an important technique for any database designer to
master and forms the basis of the methodology.
E-R diagrams are used to model real-world objects like a person, a car, a company etc. and the
relation between these real-world objects. An e-r diagram has following features:
E-R diagrams are used to represent E-R model in a database, which makes them easy to be
converted into relations (tables).
E-R diagrams provide the purpose of real-world modeling of objects which makes them intently
useful.
E-R diagrams require no technical knowledge & no hardware support.
These diagrams are very easy to understand and easy to create even by a naive user.
It gives a standard solution of visualizing the data logically.
Specialization
Generalization is like a bottom-up approach in which two or more entities of lower level combine to
form a higher level entity if they have some attributes in common.
In generalization, an entity of a higher level can also combine with the entities of the lower level to
form a further higher level entity.
Generalization is more like subclass and superclass system, but the only difference is the approach.
Generalization uses the bottom-up approach.
In generalization, entities are combined to form a more generalized entity, i.e., subclasses are
combined to make a superclass.
For example, Faculty and Student entities can be generalized and create a higher level entity Person.
Difference Between Generalization and Specialization in
Generalization DBMS
Example:
Pigeon, house sparrow, crow and dove can all be generalized as Birds −
Specialization
Example
A person has name, date of birth, gender, etc. These properties are common in all persons, human
beings. But in a company, persons can be identified as employee, employer, customer, or vendor,
based on what role they play in the company.
Types of Relationship in DBMS
A relational database collects different types of data sets that use tables, records, and columns. It is
used to create a well-defined relationship between database tables so that relational databases can be
easily stored. For example of relational databases such as Microsoft SQL Server, Oracle Database,
MYSQL, etc.
One to Many Relationship: It is used to create a relationship between two tables. Any single rows
of the first table can be related to one or more rows of the second tables, but the rows of second
tables can only relate to the only row in the first table. It is also known as a many to
one relationship.