BSC-DBMS Unit-1
BSC-DBMS Unit-1
UNIT I
Overview of Database Management System: Introduction to data, information, database, database
management systems, file-based system, Drawbacks of file-Based System, database approach,
Classification of Database Management Systems, advantages of database approach, Various Data
Models, Components of Database Management System, three schema architecture of data base, costs and
risks of database approach.
UNIT II
Entity-Relationship Model: Introduction, the building blocks of an entity relationship diagram,
classification of entity sets, attribute classification, relationship degree, relationship classification,
reducing ER diagram to tables, enhanced entity-relationship model (EERmodel), generalization and
specialization, IS A relationship and attribute inheritance, multiple inheritance, constraints on
specialization and generalization, advantages of ER modelling.
UNIT III
Relational Model: Introduction, CODD Rules, relational data model, concept of key, relational integrity,
relational algebra, relational algebra operations, advantages of relational algebra, limitations of relational
algebra, relational calculus, tuple relational calculus, domain relational Calculus (DRC), Functional
dependencies and normal forms upto 3rd normal form.
UNIT IV
Structured Query Language: Introduction, History of SQL Standard, Commands in SQL, Data Types
in SQL, Data Definition Language, Selection Operation, Projection Operation, Aggregate functions, Data
Manipulation Language, Table Modification Commands, Join Operation, Set Operations, View, Sub
Query.
UNIT V
PL/SQL: Introduction, Shortcomings of SQL, Structure of PL/SQL, PL/SQL Language Elements, Data
Types, Operators Precedence, Control Structure, Steps to Create a PL/SQL, Program, Iterative Control,
Procedure, Function, Database Triggers, Types of Triggers.
1
UNIT -I
OVERVIEW DATABASE MANAGEMENT SYSTEMS
Data
In simple words, data can be facts related to any object in consideration. For example, your name, age,
height, weight, etc. are some data related to you. A picture, image, file, pdf, etc. can also be considered
data. Data can be simple at the same time unorganized unless it is organized.
Information
Information is a set of data which is processed in a meaningful way according to the given requirement.
Information is processed, structured, or presented in a given context to make it meaningful and useful.
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.
There are many dynamic websites on the World Wide Web nowadays which are handled through
databases.
Ex:1 a model that checks the availability of rooms in a hotel. It is an example of a dynamic website that
uses a database.
Ex2: The college Database organizes the data about the admin, staff, students and faculty etc
2
Applications of DBMS:
Banks: Storing client info, account activities, disbursements, credits, and mortgages
Airlines: Flight bookings and scheduling info
Academies: Learner info, course registrations, grading, and result
Telecommunication: Keeping call archives, monthly bills, and retaining balances.
Economics and Finance: Storing data about bonds, transactions, and acquisitions of
fiscalinstruments, such as shares and stocks
Sales and Marketing: Storing data about consumers, merchandises, and sales
File Processing Systems: It was totally computer based system where all the information is store in
different computer files. Also traditional files system stores data in a manner that all the departments
of an organization have their own set of files that creates data redundancy.
In a File System, data is directly stored in set of files. It contains flat files that have no relation to other
files (when only one table is stored in single file, then this file is known as flat file).
1. Duplicate Data:
Data is stored more than once in different files, that means duplicate data may occur in all these files.
Since all the files are independent on each other so it is very difficult to overcome this error and if anyone
finds this error then it will take time and effort to solve this issue.
2. Inconsistency
In file processing system, various copies of same data may contain different values. Data is not consistent
in this system, it means if a data item needs to be changed then all the files containing that data need to be
modified. It may create a risk of out dated values of data.
Ex: If you change student name in library then his name should be changed in all the departments related
to the student.
3
For Example: The maximum marks of the student can never be more than 100.
Ex: If a student can access his data in the college library then he can easily change books issued date.
Also he can change his fine detains to zero.
Ex: If you are buying a ticket from railway and you are in the process of money transaction. Suddenly,
your internet got disconnected then you may or may not have paid for the ticket. If you have paid then
your ticket will be booked and if not then you will not be charged anything. That is called consistent
state, means you have paid or not.
7 . Wastage of Space:
File Processing System needs lots of copied data in different files that cause wastage of labor. Also
maintaining same data again and again leads to wastage of space too.
Q . DATABASE APPROACH
An information system that uses a Database Management System (DBMS) to manage its informationhas a
particular structure, comprising three components: Data, DBMS, and Application software. This structure as
described below is referred to as the database approach to information system development.
The central component of the database approach is the DBMS. This software is also referred to as the
“database engine” or the “back end.” With regard to the data it manages, it has several responsibilities
including the following:
4
primary components of a typical DBMS and how they are used in an information system. The
user interacts with the DBMS generally by writing SQL statements through the front end. we will
focus on query statements, whose purpose is to retrieve data from the database and present it in a
form that is understandable by the user.
The second component in the database approach is the data. Although the physical location.
the location of the data does not determine whether or not a system is developed using the
databaseapproach.
The final component of the database approach is the application, also called "front end" software.
In fact, the DBMS software itself is non-visual, meaning that the user does not interact directly
with the DBMS
The DBMS receives the request and determines if the operation requested is allowed for the authenticated
user. If the operation is allowed, the DBMS completes the operation and sends a response to the
application. The application then communicates the information to the user. If the operation is not
authorized for the user or if there is an error in fulfilling the operation, the DBMS responds with an
appropriate message. Again, it is up to the application to display that to the user. It is a critical feature of
the database approach that the application never bypasses the DBMS to access stored data directly.
Q . CLASSIFICATION OF DBMS
Database management systems can be classified based on several criteria, such as the data model, user
numbers and database distribution, all described below.
5
Identify the purpose of the database
Determine the tables and fields
Assign the fields to a table and reorganize as needed to minimize redundancy
Finalize the structure (primary keys, field properties, etc.)
In this, the information about the groups of parent or child relationships is present in the records which is
similar to the structure of a tree. Here the data follows a series of records, set of values attached to it.
Mainly used on a large digital computers. If there are more connections, then this database is efficient.
They are similar to hierarchical database, they look like a interconnected network of records.
6
Q . ADVANTAGES OF DATABASE APPROACH
1. Minimal Redundancy:
Data redundancy is the duplicate of same data at more than one storage place. This duplication of data
leads to wastage of storage space and time and affect cost also. This redundancy has to be eliminated by
integrating the data at one place.
2. Sharing of Data:
This means various users can use the same data in the database.
3. Consistency(validity):
Data duplication create multiple level of updation. At some occasion updation of duplication data
entries may supply incorrect or conflicting information. At such time, the database is said to be
inconsistent. Consistency of data has to be achieved through redundancy control.
4. To Provide Multiple User Interfaces:
In order to allow different users to access the database DBMS provide:-
• Query Language: Query language for casual users such as SOL to access the database.
• Programming Language Interfaces: For application programmers.
• Menu Driven Interfaces: For stand-alone users.
5. Simplicity:
Another objectives of DBMS is to make application development procedure simple and easier. To
achieve this DBMS is accompanied without powerful query manipulation and reports generations tools.
6. Flexibility:
DBMS allows change to the structure of database without affecting the stored data, the existing
application. Thus it should make the application development cheaper, faster and flexible.
7. To Restrict Unauthorized Access:
Data in database must be secured. Hence an important objective of database system is to restrict
unauthorized access.
8. Security:
security refers to the collective measures used to protect and secure a database or database management
software from illegitimate use and malicious threats and attacks.
9. Data integrity:
Integrity is a critical aspect to the design, implementation and usage of any system which stores,
processes, or retrieves data. Data integrity refers to the correctness of the data in the database. In other
words, how reliable is the data available in the database. Integrity also means your data is authentic,
accurate and consistent.
7
10. Protect :Protect the data from physical harm and unauthorized access.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.
Q . DATA 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
Hierarchical Model
Network Model
Entity-relationship Model
Relational Model
1. Hierarchical Model:
In a hierarchical model data is represented as having a parent-child relationship among each other and is
organized in a tree-like structure. The organization of data enforces a structure wherein a parent can
have many children but a child can have only one parent. Thus, this model inherently forces repetitions
of data at the child levels. The records have 1:N or more generally a "one-to- many" relationship
between them. 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.
for example, one department can have many courses, many professors and of-course many students.
2. 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.
8
3. Entity-relationship Model :
In this database model, relationships are created by dividing object of interest into entity and its
characteristics into attributes.Different entities are related using relationships.This model is good to
design a database, which can then be turned into tables in relationalmodel(explained below).
4.Relational Model:
Relational Model (RM) represents the database as a collection of relations. A relation is nothing but
a table of values. Every row in the table represents a collection of related data values. These rows in
the table denote a real-world entity or relationship.
by storing a common field. 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.Hence, tables are also known
as relations in relational model.
9
Q . COMPONENTS OF DBMS
The main component of a Database management system is the software. It is the set of programs
which is used to manage the database and to control the overall computerized database.
The DBMS software provides an easy-to-use interface to store, retrieve, and update data in the
database.
This software component is capable of understanding the Database Access Language and
converts it into actual database commands to execute or run them on the database.
Hardware:
This component of DBMS consists of a set of physical electronic devices such as computers, I/O
channels, storage devices, etc that create an interface between computers and the users.
This DBMS component is used for keeping and storing the data in the database.
Procedures:
Procedures refer to general rules and instructions that help to design the database and to use a
database management system.
Procedures are used to setup and install a new database management system (DBMS), to login
and logout of DBMS software, to manage DBMS or application programs, to take backup of the
database, and to change the structure of the database, etc.
Data:
It is the most important component of the database management system.
The main task of DBMS is to process the data. Here, databases are defined, constructed, and then
data is stored, retrieved, and updated to and from the databases.
The database contains both the metadata (description about data) and the actual (or operational)
data.
Users:
The users are the people who control and manage the databases and perform different types of
operations on the databases in the database management system.
Types of users:
Application Programmers
Database Administrators
End-Users
1. Application Programmers: The users who write the application programs in programming languages
(such as Java, C++, or Visual Basic) to interact with databases are called Application Programmer.
10
2. Database Administrators (DBA): A person who manages the overall DBMS is called a database
administrator or simply DBA. A database administrator (DBA) is the information technician
responsible for directing or performing all activities related to maintaining a successful database
environment.
3. End-Users: The end-users are those who interact with the database management system to perform
different operations by using the different database commands such as insert, update, retrieve, and delete
on the data, etc.
The three schema architecture divides the database into three-level to create a separation between
the physical database and the user application. In simple words, this architecture hides the details of
physical storage from the user. The database administrator (DBA) should be able to change the structure
of database storage without affecting the user’s view.
This architecture contains three layers or levels of the database management system:
1. External level
2. Conceptual level
3. Internal level
11
1. Internal Level
o It determines how the data is stored in the database.
o It creates indexes to the data so the records can be accessed quickly.
o It divides large tables into smaller partitions for better management and performance.
o It also includes security features so the data is never breached or hacked.
o The internal level has an internal schema which describes the physical storage structure of the
database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will be stored in a block.
o The physical level is used to describe complex low-level data structures in detail.
2. Conceptual Level
o The conceptual schema describes the design of a database at the conceptual level.
Conceptuallevel is also known as logical level.
o The conceptual schema describes the structure of the whole database.
o The conceptual level describes what data are to be stored in the database and also describes what
relationship exists among those data.
o In the conceptual level, internal details such as an implementation of the data structure are hidden.
o Programmers and database administrators work at this level.
3. External Level :
o 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.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular user group is interested and hides
the remaining database from that user group.
o The view schema describes the end user interaction with database systems.
12
Q . COSTS & RISKS OF DATABASE APPROACH
The database approach emphasizes data integration and sharing across organizations. As
with any business decision, the database approach entails some additional costs and risks
that must be recognized and managed when implementing this approach. Mentionable
some costs & risks of database approach are as follows;
2. New Specialized Personnel: Frequently, organizations that adopt the database approach
need to hire or train individuals to design & implement databases, provide database
administration services and manage a staff of new people, further, because of the rapid
changes in technology these new people will have to be retrained or upgraded on a
regular basis.
4. Conversion Costs: The cost of converting the traditional file processing systems to
modern database technology: measured in terms of money, time, and organizational
commitment.
5. Need for explicit Backup & Recovery: A shared corporate database must be accurate
and available at all times. These require that comprehensive procedures be developed
and used for providing backup copies of data and for restoring a database when damage
occurs.
13