DBMS Unit 1 Module 1
DBMS Unit 1 Module 1
What is Database
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.
Using the database, you can easily retrieve, insert, and delete the information.
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 unexpected failure.
Characteristics of DBMS
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.
DBMS can store a lot of data in it. So for all the big firms, DBMS is really ideal technology to use. It can store
thousands of records in it and one can fetch all that data whenever it is needed.
Removes Duplicity
If you have lots of data then data duplicity will occur for sure at any instance. DBMS guarantee it that there will
be no data duplicity among all the records. While storing new records, DBMS makes sure that same data was
not inserted before.
No one handles the whole database alone. There are lots of users who are able to access database. So this
situation may happen that two or more users are accessing database. They can change whatever they want, at
that time DBMS makes it sure that they can work concurrently.
Data Protection
Information such as bank details, employee’s salary details and sale purchase details should always be kept
secured. Also all the companies need their data secured from unauthorized use. DBMS gives a master level
security to their data. No one can alter or modify the information without the privilege of using that data.
Sometimes database failure occurs so there is no option like one can say that all the data has been lost. There
should be a backup of database so that on database failure it can be recovered. DBMS has the ability to backup
and recover all the data in database.
There is no need to be a master of programming language if you want to work on DBMS. Any accountant who
is having less technical knowledge can work on DBMS. All the definitions and descriptions are given in it so
that even a non-technical background w=person can work on it.
Integrity
Integrity means your data is authentic and consistent. DBMS has various validity checks that make your data
completely accurate and consistence.
Platform Independent
One can run dbms at any platform. No particular platform is required to work on database management system.
External/Conceptual Mapping
Conceptual Level
Conceptual Schema
Conceptual/Internal Mapping
Internal Schema
Database
1. Internal Level
The internal level has an internal schema which describes the physical storage structure of the database.
The internal schema is also known as a physical schema.
It uses the physical data model. It is used to define that how the data will be stored in a block.
The physical level is used to describe complex low-level data structures in detail.
2. Conceptual Level
The conceptual schema describes the design of a database at the conceptual level. Conceptual level is also known
as logical level.
The conceptual schema describes the structure of the whole database.
The conceptual level describes what data are to be stored in the database and also describes what relationship
exists among those data.
In the conceptual level, internal details such as an implementation of the data structure are hidden.
Programmers and database administrators work at this level.
3. External Level
At the external level, a database contains several schemas that sometimes called as subschema. The subschema is
used to describe the different view of the database.
An external schema is also known as view schema.
Each view schema describes the database part that a particular user group is interested and hides the remaining
database from that user group.
The view schema describes the end user interaction with database systems.
Components of DBMS
The database management system can be divided into five major components, they are:
1. Hardware
2. Software
3. Data
4. Procedures
5. Database Access Language
Let's have a simple diagram to see how they all fit together to form a database management system.
When we say Hardware, we mean computer, hard disks, I/O channels for data, and any other physical
component involved before any data is successfully stored into the memory.
When we run Oracle or MySQL on our personal computer, then our computer's Hard Disk, our Keyboard using
which we type in all the commands, our computer's RAM, ROM all become a part of the DBMS hardware.
This is the main component, as this is the program which controls everything. The DBMS software is more like
a wrapper around the physical database, which provides us with an easy-to-use interface to store, access and
update data.
The DBMS software is capable of understanding the Database Access Language and intrepret it into actual
database commands to execute them on the DB.
Data is that resource, for which DBMS was designed. The motive behind the creation of DBMS was to store
and utilise data.
In a typical Database, the user saved Data is present and meta data is stored.
Metadata is data about the data. This is information stored by the DBMS to better understand the data stored in
it.
For example: When I store my Name in a database, the DBMS will store when the name was stored in the
database, what is the size of the name, is it stored as related data to some other data, or is it independent, all this
information is metadata.
Procedures refer to general instructions to use a database management system. This includes procedures to setup
and install a DBMS, To login and logout of DBMS software, to manage databases, to take backups, generating
reports etc.
Database Access Language is a simple language designed to write commands to access, insert, update and
delete data stored in any database.
A user can write commands in the Database Access Language and submit it to the DBMS for execution, which
is then translated and executed by the DBMS.
User can create new databases, tables, insert data, fetch stored data, update data and delete the data using the
access language.
Database Users
Database Administrators: Database Administrator or DBA is the one who manages the complete
database management system. DBA takes care of the security of the DBMS, it's availability, managing
the license keys, managing user accounts and access etc.
Application Programmer or Software Developer: This user group is involved in developing and
desiging the parts of DBMS.
End User: These days all the modern applications, web or mobile, 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 DBMS systems running on their server. End users are the one who store, retrieve, update and delete
data.
Database Models
A Database model defines the logical design and structure of a database and defines how data will be stored,
accessed and updated in a database management system. While the Relational Model is the most widely used
database model, there are other models too:
Hierarchical Model
Network Model
Entity-relationship Model
Relational Model
Hierarchical Model
This database model organises data into a tree-like-structure, with a single root, to which all the other data is
linked. The heirarchy starts from the Root data, and expands like a tree, adding child nodes to the parent nodes.
In this model, a child node will only have a single parent node.
This model efficiently describes many real-world relationships like index of a book, recipes etc.
In hierarchical model, data is organised into tree-like structure with one one-to-many relationship between two
different types of data, for example, one department can have many courses, many professors and of-course
many students.
Network Model
This is an extension of the Hierarchical model. In this model data is organised more like a graph, and are
allowed to have more than one parent node.
In this database model data is more related as more relationships are established in this database model. Also, as
the data is more related, hence accessing the data is also easier and fast. This database model was used to map
many-to-many data relationships.
This was the most widely used database model, before Relational Model was introduced.
Entity-relationship Model
In this database model, relationships are created by dividing object of interest into entity and its characteristics
into attributes.
E-R Models are defined to represent the relationships into pictorial form to make it easier for different
stakeholders to understand.
This model is good to design a database, which can then be turned into tables in relational model(explained
below).
Let's take an example, If we have to design a School Database, then Student will be an entity with attributes
name, age, address etc. As Address is generally complex, it can be another entity with attributes street name,
pincode, city etc, and there will be a relationship between them.
Relationships can also be of different types. To learn about E-R Diagrams in details, click on the link.
Relational Model
In this model, data is organised in two-dimensional tables and the relationship is maintained by storing a
common field.
This model was introduced by E.F Codd in 1970, and since then it has been the most widely used database
model, infact, we can say the only database model used around the world.
The basic structure of data in the relational model is tables. All the information related to a particular type is
stored in rows of that table.
In the coming tutorials we will learn how to design tables, normalize them to reduce data redundancy and how
to use Structured Query language to access data from tables.
ER MODEL
The ER model defines the conceptual view of a database. It works around real-world entities and the
associations among them. At view level, the ER model is considered a good option for designing
databases.
Entity
An entity can be a real-world object, either animate or inanimate, that can be easily identifiable. For
example, in a school database, students, teachers, classes, and courses offered can be considered
as entities. All these entities have some attributes or properties that give them their identity.
An entity set is a collection of similar types of entities. An entity set may contain entities with attribute
sharing similar values. For example, a Students set may contain all the students of a school; likewise
a Teachers set may contain all the teachers of a school from all faculties. Entity sets need not be
disjoint.
Entities are represented by means of rectangles. Rectangles are named with the entity set they
represent.
Attributes
Entities are represented by means of their properties, called attributes. All attributes have values.
For example, a student entity may have name, class, and age as attributes.
There exists a domain or range of values that can be assigned to attributes. For example, a
student's name cannot be a numeric value. It has to be alphabetic. A student's age cannot be
negative, etc.
Attributes are the properties of entities. Attributes are represented by means of ellipses. Every ellipse
represents one attribute and is directly connected to its entity (rectangle).
Types of Attributes
Simple attribute − Simple attributes are atomic values, which cannot be divided further. For
example, a student's phone number is an atomic value of 10 digits.
Composite attribute − Composite attributes are made of more than one simple attribute. For
example, a student's complete name may have first_name and last_name.
If the attributes are composite, they are further divided in a tree like structure. Every node is then
connected to its attribute. That is, composite attributes are represented by ellipses that are
connected with an ellipse.
Derived attribute − Derived attributes are the attributes that do not exist in the physical
database, but their values are derived from other attributes present in the database. For
example, average_salary in a department should not be saved directly in the database,
instead it can be derived. For another example, age can be derived from data_of_birth.
Derived attributes are depicted by dashed ellipse.
Single-value attribute − Single-value attributes contain single value. For example −
Social_Security_Number.
Multi-value attribute − Multi-value attributes may contain more than one values. For
example, a person can have more than one phone number, email_address, etc.
Relationship
The association among entities is called a relationship. For example, an employee works_at a
department, a student enrolls in a course. Here, Works_at and Enrolls are called relationships.
Relationship Set
A set of relationships of similar type is called a relationship set. Like entities, a relationship too can
have attributes. These attributes are called descriptive attributes.
Degree of Relationship
The number of participating entities in a relationship defines the degree of the relationship.
Binary = degree 2
Ternary = degree 3
n-ary = degree
Mapping Cardinalities
Cardinality defines the number of entities in one entity set, which can be associated with the
number of entities of other set via relationship set.
One-to-one − One entity from entity set A can be associated with at most one entity of entity
set B and vice versa.
One-to-many − One entity from entity set A can be associated with more than one entities of
entity set B however an entity from entity set B, can be associated with at most one entity.
Many-to-one − More than one entities from entity set A can be associated with at most one
entity of entity set B, however an entity from entity set B can be associated with more than
one entity from entity set A.
Many-to-many − One entity from A can be associated with more than one entity from B and
vice versa.
Database Schema
A database schema is the skeleton structure that represents the logical view of the entire database.
It defines how the data is organized and how the relations among them are associated. It formulates
all the constraints that are to be applied on the data.
A database schema defines its entities and the relationship among them. It contains a descriptive
detail of the database, which can be depicted by means of schema diagrams. It’s the database
designers who design the schema to help programmers understand the database and make it
useful.