Dbms and Its Managerial Applications (Code: 307D) Unit-I: (A) Introduction To Database and Dbms Software: Database
Dbms and Its Managerial Applications (Code: 307D) Unit-I: (A) Introduction To Database and Dbms Software: Database
UNIT-I
(A) INTRODUCTION TO DATABASE AND DBMS SOFTWARE:
Database:
A database is a collection of related data which represents some aspect of the real world. A database
system is designed to be built and populated with data for a certain task.
DBMS:
Database Management System (DBMS) is a software for storing and retrieving users' data while
considering appropriate security measures. It consists of a group of programs which manipulate the
database. The DBMS accepts the request for data from an application and instructs the operating system
to provide the specific data. In large systems, a DBMS helps users and other third-party software to store
and retrieve data.
DBMS allows users to create their own databases as per their requirement. The term “DBMS” includes
the user of the database and other application programs. It provides an interface between the data and the
software application.
Example:
1
Popular DBMS Software:
MySQL
Microsoft Access
Oracle
PostgreSQL
dBASE
FoxPro
SQLite
IBM DB2
LibreOffice Base
MariaDB
Microsoft SQL Server etc.
Application of DBMS:
Banking Sector- For customer information, account activities, payments, deposits, loans, etc.
Airlines Sector- For reservations and schedule information.
Universities Sector- For student information, course registrations, colleges and grades.
Telecommunication Sector- It helps to keep call records, monthly bills, maintaining balances,
etc.
Finance Sector- For storing information about stock, sales, and purchases of financial
instruments like stocks and bonds.
Sales Sector- Use for storing customer, product & sales information.
Manufacturing Sector- It is used for the management of supply chain and for tracking
production of items. Inventories status in warehouses.
HR Management Sector- For information about employees, salaries, payroll, deduction,
generation of paychecks, etc.
Types of DBMS:
Hierarchical database
Network database
Relational database
Object-Oriented database
Hierarchical Model:
In a Hierarchical database, model data is organized in a tree-like structure. Data is Stored Hierarchically
(top down or bottom up) format. Data is represented using a parent-child relationship. In Hierarchical
DBMS parent may have many children, but children have only one parent.
2
Network Model:
The network database model allows each child to have multiple parents. It helps you to address the need
to model more complex relationships like as the orders/parts many-to-many relationship. In this model,
entities are organized in a graph which can be accessed through several paths.
Relational Model:
Relational DBMS is the most widely used DBMS model because it is one of the easiest. This model is
based on normalizing data in the rows and columns of the tables. Relational model stored in fixed
structures and manipulated using SQL.
Object-Oriented Model:
In Object-oriented Model data stored in the form of objects. The structure which is called classes which
display data within it. It defines a database as a collection of objects which stores both data members
values and operations.
Advantages of DBMS:
Disadvantage of DBMS:
Cost of Hardware and Software of a DBMS is quite high which increases the budget of your
organization.
Most database management systems are often complex systems, so the training for users to use
the DBMS is required.
In some organizations, all data is integrated into a single database which can be damaged
because of electric failure or database is corrupted on the storage media
Use of the same program at a time by many users sometimes lead to the loss of some data.
DBMS can't perform sophisticated calculations
3
ADVANTAGES AND DISADVANTAGES OF DATABASE:
Advantages:
A number of advantages of applying database approach in application system are:
The database approach attempts to eliminate the redundancy by integrating the file. Although the
database approach does not eliminate redundancy entirely, it controls the amount of redundancy inherent
in the database.
2. Data consistency
By eliminating or controlling redundancy, the database approach reduces the risk of inconsistencies
occurring. It ensures all copies of the data are kept consistent.
With the integration of the operated data in the database approach, it may be possible to derive
additional information for the same data.
4. Sharing of data
Database belongs to the entire organization and can be shared by all authorized users.
Database integrity provides the validity and consistency of stored data. Integrity is usually expressed in
terms of constraints, which are consistency rules that the database is not permitted to violate.
6. Improved security
Database approach provides a protection of the data from the unauthorized users. It may take the term of
user names and passwords to identify user type and their access right in the operation including retrieval,
insertion, updating and deletion.
7. Enforcement of standards
The integration of the database enforces the necessary standards including data formats, naming
conventions, documentation standards, update procedures and access rules.
8. Economy of scale
Cost savings can be obtained by combining all organization's operational data into one database with
applications to work on one source of data.
4
9. Balance of conflicting requirements
By having a structural design in the database, the conflicts between users or departments can be
resolved. Decisions will be based on the base use of resources for the organization as a whole rather that
for an individual entity.
By having an integration in the database approach, data accessing can be crossed departmental
boundaries. This feature provides more functionality and better services to the users.
The database approach provides all the low-level file-handling routines. The provision of these functions
allows the programmer to concentrate more on the specific functionality required by the users. The
fourth-generation environment provided by the database can simplify the database application
development.
Database approach provides a data independence. As a change of data structure in the database will be
affect the application program, it simplifies database application maintenance.
Database can manage concurrent data access effectively. It ensures no interference between users that
would not result any loss of information or loss of integrity.
Modern database management system provides facilities to minimize the amount of processing that can
be lost following a failure by using the transaction approach.
Disadvantages:
1. Complexity
Database management system is an extremely complex piece of software. All parties must be familiar
with its functionality and take full advantage of it. Therefore, training for the administrators, designers
and users is required.
2. Size
The database management system consumes a substantial amount of main memory as well as a large
number amount of disk space in order to make it run efficiently.
5
3. Cost of DBMS
A multi-user database management system may be very expensive. Even after the installation, there is a
high recurrent annual maintenance cost on the software.
4. Cost of conversion
When moving from a file-base system to a database system, the company is required to have additional
expenses on hardware acquisition and training cost.
5. Performance
As the database approach is to cater for many applications rather than exclusively for a particular one,
some applications may not run as fast as before.
The database approach increases the vulnerability of the system due to the centralization. As all users
and applications reply on the database availability, the failure of any component can bring operations to
a halt and affect the services to the customer seriously.
ER Model:
Entity Relational (ER) Model is a high-level conceptual data model diagram. ER modeling helps you to
analyze data requirements systematically to produce a well-designed database. The Entity-Relation
model represents real-world entities and the relationship between them. It is considered a best practice to
complete ER modeling before implementing your database.
History of ER Models:
ER diagrams are a visual tool which is helpful to represent the ER model. It was proposed by Peter Chen
in 1971 to create a uniform convention which can be used for relational database and network. He aimed
to use an ER model as a conceptual modeling approach.
ER Diagrams:
Entity-Relationship Diagram (ERD) displays the relationships of entity set stored in a database. In other
words, we can say that ER diagrams help you to explain the logical structure of databases. At first look,
an ER diagram looks very similar to the flowchart. However, ER Diagram includes many specialized
symbols, and its meanings make this model unique. The purpose of ER Diagram is to represent the
entity framework infrastructure.
6
Facts about ER Diagram Model:
Example
For example, in a University database, we might have entities for Students, Courses, and Lecturers.
Students’ entity can have attributes like Roll no, Name, and Dept. ID. They might have relationships
with Courses and Lecturers.
Entity:
A real-world thing either living or non-living that is easily recognizable and non recognizable. It is
anything in the enterprise that is to be represented in our database. It may be a physical thing or simply a
fact about the enterprise or an event that happens in the real world.
An entity can be place, person, object, event or a concept, which stores data in the database. The
characteristics of entities are must have an attribute, and a unique key. Every entity is made up of some
'attributes' which represent that entity.
7
Examples of Entities:
Notation of an Entity
Entity Set:
Student
An entity set is a group of similar kind of entities. It may contain entities with attribute sharing similar
values. Entities are represented by their properties, which also called attributes. All attributes have their
separate values. For example, a student entity may have a name, age, class, as attributes.
Example of Entities:
A university may have some departments. All these departments employ various lecturers and offer
several programs.
Some courses make up each program. Students register in a particular program and enroll in various
courses. A lecturer from the specific department takes each course, and each lecturer teaches a various
group of students.
Relationship:
Relationship is nothing but an association among two or more entities. E.g., Tom works in the
Chemistry department.
Entities take part in relationships. We can often identify relationships with verbs or verb phrases.
8
For example:
Attributes:
For example, a lecture might have attributes: time, date, duration, place, etc.
Types of Attributes:
Simple attribute- Simple attributes can't be divided any further. For example, a student's contact
number. It is also called an atomic value.
Composite attribute- It is possible to break down composite attribute. For example, a student's full
name may be further divided into first name, second name, and last name.
Derived attribute- This type of attribute does not include in the physical database. However, their
values are derived from other attributes present in the database. For example, age should not be stored
directly. Instead, it should be derived from the DOB of that employee.
Multivalued attribute- Multivalued attributes can have more than one values. For example, a student
can have more than one mobile number, email address, etc.
Cardinality:
Defines the numerical attributes of the relationship between two entities or entity sets.
9
Different types of cardinal relationships are:
One-to-One Relationships
One-to-Many Relationships
May to One Relationships
Many-to-Many Relationships
1. One-to-one:
One entity from entity set X can be associated with at most one entity of entity set Y and vice versa.
Example: One student can register for numerous courses. However, all those courses have a single line
back to that one student.
2. One-to-many:
One entity from entity set X can be associated with multiple entities of entity set Y, but an entity from
entity set Y can be associated with at least one entity.
3. Many to One
More than one entity from entity set X can be associated with at most one entity of entity set Y.
However, an entity from entity set Y may or may not be associated with more than one entity from
entity set X.
10
4. Many to Many:
One entity from X can be associated with more than one entity from Y and vice versa.
For example, Students as a group are associated with multiple faculty members, and faculty members
can be associated with multiple students.
ER- Diagram is a visual representation of data that describe how data is related to each other.
11
Steps to Create an ERD:
Example:
In a university, a Student enrolls in Courses. A student must be assigned to at least one or more Courses.
Each course is taught by a single Professor. To maintain instruction quality, a Professor can deliver only
one course
Student
Course
Professor
12
Step 4) Identify Attributes
You need to study the files, forms, reports, data currently maintained by the organization to identify
attributes. You can also conduct interviews with various stakeholders to identify entities. Initially, it's
important to identify the attributes without mapping them to a particular entity.
Once, you have a list of Attributes, you need to map them to the identified entities. Ensure an attribute is
to be paired with exactly one entity. If you think an attribute should belong to more than one entity, use
a modifier to make it unique.
Once the mapping is done, identify the primary Keys. If a unique key is not readily available, create one.
For Course Entity, attributes could be Duration, Credits, Assignments, etc. For the sake of ease we have
considered just one attribute.
13
Step 5) Create the ERD
DATABASE MODELS:
A database model defines the manner in which various files of a database are linked together. Four
commonly used database models are hierarchical, network, relational and object-oriented. Also known
as database structures or database structuring techniques.
HIERARCHICAL MODEL:
A hierarchical model represents the data in a tree-like structure in which there is a single parent for each
record. To maintain order there is a sort field which keeps sibling nodes into a recorded manner. These
types of models are designed basically for the early mainframe database management systems, like the
Information Management System (IMS) by IBM.
This model structure allows the one-to-one and a one-to-many relationship between two/ various types
of data. This structure is very helpful in describing many relationships in the real world; table of
contents, any nested and sorted information.
The hierarchical structure is used as the physical order of records in storage. One can access the records
by navigating down through the data structure using pointers which are combined with sequential
accessing. Therefore, the hierarchical structure is not suitable for certain database operations when a full
path is not also included for each record.
Data in this type of database is structured hierarchically and is typically developed as an inverted tree.
The "root" in the structure is a single table in the database and other tables act as the branches flowing
from the root. The diagram below shows a typical hierarchical database structure.
14
In the above diagram, an agent books several entertainers, and each entertainer, in return has his/her own
schedule. It is the duty of an agent to maintain several clients whose entertainment needs are to be met.
A client books engagement through the agent and makes payments to the agent for his services.
A relationship in this database model is represented by the term parent/child. A parent table can be
linked with one or more child tables in this type of relationship, but a single child table can be linked
with only one parent table. The tables are explicitly linked via a pointer/index or by the physical
arrangement of the records within the tables.
A user can access the data by starting at the root table and working down through the tree to the target
data. The user must be familiar with the structure of the database to access the data without any
complexity.
Advantages
A user can retrieve data very quickly due to the presence of explicit links between the table
structures.
The referential integrity is built in and automatically enforced due to which a record in a child
table must be linked to an existing record in a parent table, along with that if a record deleted in
the parent table then that will cause all associated records in the child table to be deleted as well.
Disadvantages
When a user needs to store a record in a child table that is currently unrelated to any record in a
parent table, it gets difficulty in recording and user must record an additional entry in the parent
table.
This type of database cannot support complex relationships, and there is also a problem of
redundancy, which can result in producing inaccurate information due to the inconsistent
recording of data at various sites.
15
NETWORK MODEL:
The network model is the extension of the hierarchical structure because it allows many-to-many
relationships to be managed in a tree-like structure that allows multiple parents.
There are two fundamental concepts of a network model −
It can represent redundancy in data more efficiently than that in the hierarchical model.
There can be more than one path from a previous node to successor node/s.
The operations of the network model are maintained by indexing structure of linked list (circular)
where a program maintains a current position and navigates from one record to another by
following the relationships in which the record participates.
Records can also be located by supplying key values.
The following diagram depicts a network model. An agent represents several clients and manages
several entertainers. Each client schedules any number of engagements and makes payments to the agent
for his or her services. Each entertainer performs several engagements and may play a variety of musical
styles.
16
Advantages
A user must be very familiar with the structure of the database to work through the set structures.
Updating inside this database is a tedious task. One cannot change a set structure without
affecting the application programs that use this structure to navigate through the data. If you
change a set structure, you must also modify all references made from within the application
program to that structure.
RELATION MODEL:
Relational data model is the primary data model, which is used widely around the world for data storage
and processing. This model is simple and it has all the properties and capabilities required to process
data with storage efficiency.
Concepts
Tables − In relational data model, relations are saved in the format of Tables. This format stores the
relation among entities. A table has rows and columns, where rows represent records and columns
represent the attributes.
Tuple − A single row of a table, which contains a single record for that relation is called a tuple.
Relation instance − A finite set of tuples in the relational database system represents relation instance.
Relation instances do not have duplicate tuples.
Relation schema − A relation schema describes the relation name (table name), attributes, and their
names.
Relation key − Each row has one or more attributes, known as relation key, which can identify the row
in the relation (table) uniquely.
Attribute domain − Every attribute has some pre-defined value scope, known as attribute domain.
Constraints
Every relation has some conditions that must hold for it to be a valid relation. These conditions are
called Relational Integrity Constraints. There are three main integrity constraints −
Key constraints
Domain constraints
Referential integrity constraints
17
Key Constraints
There must be at least one minimal subset of attributes in the relation, which can identify a tuple
uniquely. This minimal subset of attributes is called key for that relation. If there are more than one
such minimal subset, these are called candidate keys.
Key constraints force that −
in a relation with a key attribute, no two tuples can have identical values for key attributes.
a key attribute can not have NULL values.
Key constraints are also referred to as Entity Constraints.
Domain Constraints
Attributes have specific values in real-world scenario. For example, age can only be a positive integer.
The same constraints have been tried to employ on the attributes of a relation. Every attribute is bound
to have a specific range of values. For example, age cannot be less than zero and telephone numbers
cannot contain a digit outside 0-9.
(C) NORMALIZATION:
Normalization is a database design technique that reduces data redundancy and eliminates undesirable
characteristics like Insertion, Update and Deletion Anomalies. Normalization rules divides larger tables
into smaller tables and links them using relationships. The purpose of Normalization in SQL is to
eliminate redundant (repetitive) data and ensure data is stored logically.
The inventor of the relational model Edgar Codd proposed the theory of normalization with the
introduction of the First Normal Form, and he continued to extend theory with Second and Third
Normal Form. Later he joined Raymond F. Boyce to develop the theory of Boyce-Codd Normal Form.
18
Database Normalization with Examples:
Assume, a video library maintains a database of movies rented out. Without any normalization, all
information is stored in one table as shown below.
Table 1
Here you see Movies Rented column has multiple values. Now let's move into 1st Normal Forms:
1NF Example:
A KEY is a value used to identify a record in a table uniquely. A KEY could be a single column or
combination of multiple columns
Note: Columns in a table that are NOT used to identify a record uniquely are called non-key columns.
A primary key is a single column value used to identify a database record uniquely.
A composite key is a primary key composed of multiple columns used to identify a record uniquely.
In our database, we have two people with the same name Robert Phil, but they live in different places.
Hence, we require both Full Name and Address to identify a record uniquely. That is a composite key.
Rule 1- Be in 1NF
Rule 2- Single Column Primary Key
It is clear that we can't move forward to make our simple database in 2nd Normalization form unless we
partition the table above.
20
Table 1
Table 2
We have divided our 1NF table into two table’s viz. Table 1 and Table2. Table 1 contains member
information. Table 2 contains information on movies rented.
We have introduced a new column called Membership_id which is the primary key for table 1. Records
can be uniquely identified in Table 1 using membership id.
Foreign Key references the primary key of another Table. It helps connect your Tables.
A foreign key can have a different name from its primary key
It ensures rows in one table have corresponding rows in another
Unlike the Primary key, they do not have to be unique. Most often they aren't
Foreign keys can be null even though primary keys can not
21
Why do you need a foreign key?
22
You will only be able to insert values into your foreign key that exist in the unique key in the parent
table. This helps in referential integrity.
The above problem can be overcome by declaring membership id from Table2 as foreign key of
membership id from Table1
Now, if somebody tries to insert a value in the membership id field that does not exist in the parent table,
an error will be shown!
A transitive functional dependency is when changing a non-key column, might cause any of the other
non-key columns to change
Consider the table 1. Changing the non-key column Full Name may change Salutation.
Rule 1- Be in 2NF
Rule 2- Has no transitive functional dependencies
To move our 2NF table into 3NF, we again need to again divide our table.
3NF Example
Table 1
23
Table 2
Table 3
We have again divided our tables and created a new table which stores Salutations.
There are no transitive functional dependencies, and hence our table is in 3NF
In Table 3 Salutation ID is primary key, and in Table 1 Salutation ID is foreign to primary key in Table
3.
Now our little example is at a level that cannot further be decomposed to attain higher normal forms of
normalization. In fact, it is already in higher normalization forms. Separate efforts for moving into next
levels of normalizing data are normally needed in complex databases. However, we will be discussing
next levels of normalizations in brief in the following.
REFERENCES:
1. Kumar Pranab and Gupta Das, “Database Management System, Oracle SQL and PL/SQL, PHI
Publication.
2. Navathe E, “Fundamentals of Database Systems”, Pearson Education.
3. Sinha Pradeep K. and Sinha Priti, “Computer Fundamentals”, BPB Publications, Fourth Edition.
4. https://www.guru99.com
5. https://www.lechaamwe.weebly.com
6. https://www.tutorialspoint.com
24