Unit I
Unit I
VIEWS OF DATA
The provision given by the database management system to view of data by the people or users of enterprise is
called as views of data.
The main function of the database management system is to provide users a concrete view of data (actual
existence).
The concrete view is called as abstract view.
DATA ABSTRACTION
2. LOGICAL VIEW
3. VIEW LEVEL
This is the highest level of data abstraction. It provides many views for the same database. The complexity if any
that exists in the logical level can be removed here. This complexity may be due to the large size of the database.
The users at this level view the data without the complexity of physical level as well as logical level.
DATA MODELS
Data model is a collection of conceptual tools for data, data relationships, data semantics and consistency constraints.
Data modeling is used for representing entities of Interest and the relationship in the database. Most of the data represent
1|Page SUBJECT TEACHER: MA’AM MALA DAS
UNIT-I BCA-22 DATABASE MANAGEMENT SYSTEM & RDBMS
data models provides mechanism to structure data for the entities being modelled and allow set of operations to be defined
on them. The models can also enforce a set of constraints to maintain integrity of the data. DBMS systems based on these
models are available from various software houses and are used to maintain corporate database.
The various data models that have been proposed fall into three different groups –
These types of models are used for describing data at the Logical and view levels. They are characterized by the fact that
they provide fairly flexible structuring capabilities and allow data constraints to be specified explicitly. There are many
different models and more are likely to come. Several of the more widely known ones are –
E-R Model
The object oriented model
The semantic data model
The functional data model
E-R MODEL
The E-R data model is based on a perception of a real worker that consists of a collection of basic objects, called entities
and of relationship among these objects.
The overall logical structure of a database can be expressed graphically by an E-R diagram. This is built up by the
following components –
Example: suppose we have two entity sets like customer and account then these two entities can be modeled as follows.
The E-R diagram used for representing E-R Model can be easily converted into Relations (tables) in Relational
Model.
2|Page SUBJECT TEACHER: MA’AM MALA DAS
UNIT-I BCA-22 DATABASE MANAGEMENT SYSTEM & RDBMS
The E-R Model is used for the purpose of good database design by the database developer so to use that data
model in various DBMS.
It is helpful as a problem decomposition tool as it shows the entities and the relationship between those entities.
It is inherently an iterative process. On later modifications, the entities can be inserted into this model.
It is very simple and easy to understand by various types of users and designers because specific standards are
used for their representation.
Like E-R model the object-oriented model is based on a collection of objects. An object contains values stored in instance
variables within the object. An object also contains bodies of code that operate on the object. These bodies of code are
called methods.
Classes: it is the collection of objects which consists of the same type of values and the same methods.
Example: account number and balance are instance variable; pay-interest is a method that uses the above two variables
and adds interest to the balance.
Object: An object is a unique entity, which contains data /values and functions/methods (characteristics and behavior)
together. An object in the real world can possess the following characteristics –
It is visible.
It can be defined and described easily.
It can be put into thought and actions
Example of an Object:
A potato which possesses characteristics such as it is brown in color, it is spherical in shape and for the behavior it
is used as a vegetable.
In payroll system, object may be an employee where characteristics are name, destination, basic pay and behavior
as calculating gross pay, calculating provident fund, printing pay slip etc.
SEMANTIC MODEL
These include the extended relational and the semantic network and the functional models. They are characterized by their
provision of richer facilities for capturing the meaning of data objects and hence of maintaining database integrity systems
based on these models exist in monotype for at the time of writing and will begin to filter through the next decade.
Record based logical models are also used in describing data at the logical and view levels in contrast to object based data
models they are used both to specify the overall logical structures of the database and to provide a higher level description
of the implementation.
Record based models are so named because the database is structured in fixed format records of several types. Each
record type defines a fixed number of fields, or attributes and each field is usually of a fixed length. The three most widely
accepted record based data models are –
Relational model
Network model
Relational model
The relational model uses a collection of tables to represent both data and the relationships among those data. Each table
has multiple columns and each column has a unique name as follows –
Network model
Data in the network model is represented by collection of records, and relationship among data is represented by links,
which can be viewed as pointers. The record is the database are organized as collection of arbitrary graphs. Such type of
database is shown below –
Hierarchical model
The hierarchical model is similar to the network model in the sense that data and relationships among data are represented
by records and links respectively. It differs from the network model in that records are organized as collection of trees
rather than arbitrary graphs.
Advantage of DBMS
The DBMS helps create an environment in which end users have better access to more and better-managed data.
Such access makes it possible for end users to respond quickly to changes in their environment.
The more users access the data, the greater the risks of data security breaches. Corporations invest considerable
amounts of time, effort, and money to ensure that corporate data are used properly.
A DBMS provides a framework for better enforcement of data privacy and security policies.
Wider access to well-managed data promotes an integrated view of the organization’s operations and a clearer
view of the big picture.
It becomes much easier to see how actions in one segment of the company affect other segments.
Data inconsistency exists when different versions of the same data appear in different places.
For example, data inconsistency exists when a company’s sales department stores a sales representative’s name as
“Bill Brown” and the company’s personnel department stores that same person’s name as “William G. Brown,” or
when the company’s regional sales office shows the price of a product as $45.95 and its national sales office
shows the same product’s price as $43.95.
The probability of data inconsistency is greatly reduced in a properly designed database.
Better-managed data and improved data access make it possible to generate better-quality information, on which
better decisions are based.
The quality of the information generated depends on the quality of the underlying data.
Data quality is a comprehensive approach to promoting the accuracy, validity, and timeliness of the data. While
the DBMS does not guarantee data quality, it provides a framework to facilitate data quality initiatives.
The availability of data, combined with the tools that transform data into usable information, empowers end users
to make quick, informed decisions that can make the difference between success and failure in the global
economy.
Advantages of DBMS
DBMS helps in efficient organization of data in database which has following advantages over typical file system.
Minimized redundancy and data consistency: Data is normalized in DBMS to minimize the redundancy which
helps in keeping data consistent. For Example, student information can be kept at one place in DBMS and
accessed by different users.
Simplified Data Access: A user need only name of the relation not exact location to access data, so the process is
very simple.
Multiple data views: Different views of same data can be created to cater the needs of different users. For
Example, faculty salary information can be hidden from student view of data but shown in admin view.
Data Security: Only authorized users are allowed to access the data in DBMS. Also, data can be encrypted by
DBMS which makes it secure.
Concurrent access to data: Data can be accessed concurrently by different users at same time in DBMS.
Backup and Recovery mechanism: DBMS backup and recovery mechanism helps to avoid data loss and data
inconsistency in case of catastrophic failures.
Disadvantage of DBMS
1. Increased costs:
Database systems require sophisticated hardware and software and highly skilled personnel.
The cost of maintaining the hardware, software, and personnel required to operate and manage a database system
can be substantial. Training, licensing, and regulation compliance costs are often overlooked when database
systems are implemented.
2. Management complexity:
Database systems interface with many different technologies and have a significant impact on a company’s
resources and culture.
3. Maintaining currency:
To maximize the efficiency of the database system, you must keep your system current.
Therefore, you must perform frequent updates and apply the latest patches and security measures to all
components.
Because database technology advances rapidly, personnel training costs tend to be significant. Vendor
dependence.
Given the heavy investment in technology and personnel training, companies might be reluctant to change
database vendors.
DBMS vendors frequently upgrade their products by adding new functionality. Such new features often come
bundled in new upgrade versions of the software.
Some of these versions require hardware upgrades. Not only do the upgrades themselves cost money, but it also
costs money to train database users and administrators to properly use and manage the new features.
Language for accessing and manipulating the data organized by the appropriate data model
DML also known as query language
Two classes of languages
Procedural – user specifies what data is required and how to get those data
Nonprocedural – user specifies what data is required without specifying how to get those data
SQL is the most widely used query language
A transaction is a collection of operations that performs a single logical function in a database application.
Each transaction is a unit of both atomicity and consistency.
Whenever certain transaction is performed over database then it must be performed under the control.
DBMS (Database Management System) acts as an interface between the user and the database. The user requests
the DBMS to perform various operations such as insert, delete, update and retrieval on the database.
The components of DBMS perform these requested operations on the database and provide necessary data to the
users.
Components of a DBMS
The various components of DBMS are described below. The components of DBMS can be divided into two parts:
DDL Compiler:
Data Definition Language compiler processes schema definitions specified in the DDL.
It includes metadata information such as the name of the files, data items, storage details of each file, mapping
information and constraints etc.
The DML commands such as insert, update, delete, retrieve from the application program are sent to the DML
compiler for compilation into object code for database access.
The object code is then optimized in the best way to execute a query by the query optimizer and then send to the
data manager.
Data Manager:
The Data Manager is the central software component of the DBMS also knows as Database Control System.
The Main Functions Of Data Manager Are:
o Convert operations in user's Queries coming from the application programs or combination of DML
Compiler and Query optimizer which is known as Query Processor from user's logical view to physical
file system.
o Controls DBMS information access that is stored on disk.
7|Page SUBJECT TEACHER: MA’AM MALA DAS
UNIT-I BCA-22 DATABASE MANAGEMENT SYSTEM & RDBMS
o It also controls handling buffers in main memory.
o It also enforces constraints to maintain consistency and integrity of the data.
o It also synchronizes the simultaneous operations performed by the concurrent users.
o It also controls the backup and recovery operations.
Data Dictionary:
Data Dictionary, which stores metadata about the database, in particular the schema of the database.
Names of the tables, names of attributes of each table, length of attributes, and number of rows in each table.
Detailed information on physical database design such as storage structure, access paths, files and record sizes.
Usage statistics such as frequency of query and transactions.
Data dictionary is used to actually control the data integrity, database operation and accuracy. It may be used as a
important part of the DBMS
Compiled DML: The DML complier converts the high level Queries into low level file access commands known as
compiled DML.
End Users:
The second class of users then is end user, who interacts with system from online workstation or terminals.
Use the interface provided as an integral part of the database system software.
User can request, in form of query, to access database either directly by using particular language, such as SQL,
or by using some pre-developed application interface.
Such requests are sent to query evaluation engine via DML pre-compiler and DML compiler.
The query evaluation engine accepts the query and analyses it.
It finds the suitable way to execute the compiled SQL statements of the query.
Finally, the compiled SQL statements are executed to perform the specified operation
Functions of DBMS:
DBMS free the programmers from the need to worry about the organization and location of the data i.e. it shields
the users from complex hardware level details.
DBMS can organize process and present data elements from the database. This capability enables decision makers
to search and query database contents in order to extract answers that are not available in regular Reports.
Programming is speeded up because programmer can concentrate on logic of the application.
It includes special user friendly query languages which are easy to understand by non-programming users of the
system.
Authorization services like log on to the DBMS start the database stop the Database etc.
Transaction supports like Recovery, Rollback etc,
Import and Export of Data.
Maintaining data dictionary
User's Monitoring
Data Administrator and Database Administrator both are responsible for managing database for an organization.
They differ from each other in their required skills and responsibilities.
"Person in the organization who controls the data of the database refers data administrator."
DA determines what data to be stored in database based on requirement of the organization.
DA works on such as requirements gathering, analysis, and design phases.
DA does not to be a technical person, any kind of knowledge about database technology can be more beneficiary
DA is some senior level person in the organization.
In short, DA is a business focused person but should understand about the database technology.
"Person in the organization who controls the design and the use of the database refers database administrator."
DBA provides necessary technical support for implementing a database.
DBA works on such as design, development, testing, and operational phases.
DBA is a technical person having knowledge of database technology.
DBA does not need to be a business person.
In short, DBA is a technically focused person but should understand about the business to administrator the
database effectively.
The DBA decides how the data is to be represented in the stored database.
The DBA modifies the physical organization of the database to reflect the changing needs of the organization or
to improve performance.
The DBA determines which user needs access to which part of the database.
According to this, various types of authorizations are granted to different users.
6. Monitoring Performance:
DBMS 3-tier architecture divides the complete system into three inter-related but independent modules.
Data Independence
Data independence means change of data at one level should not affect another level.
Physical Data Independence: Any change in physical location of tables and indexes should not affect conceptual
level or external view of data. This data independence is easy to achieve and implemented by most of the DBMS.
Conceptual Data Independence: The data at conceptual level schema and external level schema must be
independent. This means, change in conceptual schema should not affect external schema. e.g.; Adding or
deleting attributes of a table should not affect the user’s view of table. But this type of independence is difficult to
achieve as compared to physical data independence because the changes in conceptual schema are reflected in
user’s view.
Database designing for a real world application starts from capturing the requirements to physical implementation using
DBMS software which consists of following steps –
Conceptual Design: The requirements of database are captured using high level
conceptual data model. For Example, ER model is used for conceptual design of
database.
Logical Design: Logical Design represents data in the form of relational model. ER
diagram produced in conceptual design phase is used to convert the data into
Relational Model.
Physical Design: In physical design, data in relational model is implemented using
commercial DBMS like Oracle, DB2.
Database Management Systems: A Database is a collection of records. Database management systems are designed as
the means of managing all the records. Database Management is a software system that uses a standard method and
running queries with some of them designed for the oversight and proper control of databases.
1. Hierarchical databases.
2. Network databases.
11 | P a g e SUBJECT TEACHER: MA’AM MALA DAS
UNIT-I BCA-22 DATABASE MANAGEMENT SYSTEM & RDBMS
3. Relational databases.
4. Object-oriented databases
information.
In this structure Data follows a series of records; it is a set of field
values attached to it.
It collects all records together as a record type.
These record types are the equivalent of tables in the relational model,
and with the individual records being the equivalent of rows.
To create links between these record types, the hierarchical model
uses these type Relationships.
Advantage
Hierarchical database can be accessed and updated rapidly because in this model structure is like as a tree and the
relationships between records are defined in advance. This feature is a two-edged.
Disadvantage
This type of database structure is that each child in the tree may have only one parent, and relationships or
linkages between children are not permitted, even if they make sense from a logical standpoint.
Hierarchical databases are so in their design.
It can add a new field or record requires that the entire database be redefined.
Network Database
Relational Databases
Object-Oriented Model
2 Data Redundancy In file System Approach, each user defines and Although the database
implements the needed files for a specific application to approach does not remove
run. For example in sales department of an enterprise, redundancy completely, it
one user will be maintaining the details of how many controls the amount of
sales personnel are there in the sales department and redundancy in the database
their grades. Another user will be maintaining the sales because in database
person salary details. approach, a single
repository of data is
maintained that is defined
once and then accessed by
many users. The
fundamental characteristic
of database approach is that
the database system not only
contains data’s but it
contains complete definition
or description of the
database structure and
constraints.
3 Sharing of Data File system doesn’t allow sharing of data or data In DBMS data can be shared
sharing is very complex. very easily due to
centralized system.
4 Data Consistency When data is redundant, it is difficult to update, for e.g. In DBMS, as there is no or
if we want to change or update employee’s address, less data redundancy, data
then we have to make changes at all the places where remains consistent.
data of that employee is stored. If by mistake, we forgot
to change or update the address at one or more place
then data inconsistency will occur i.e. the appearance of
same data will differ from each other.
5 Difficult to In conventional file system, if we want to search/ In DBMS
search/access Data retrieve/ access some data item, it becomes very searching/retrieval/accessing
difficult because in file system for every operation we of data item is very easy and
have to make different programs. user-friendly because
searching and querying
operations are already
available in the system.
6 Data Isolation In file system, there is no standard format of data or we In DBMS, due to centralized
16 | P a g e SUBJECT TEACHER: MA’AM MALA DAS
UNIT-I BCA-22 DATABASE MANAGEMENT SYSTEM & RDBMS
can say data is scattered in various formats or files system the format of similar
which also make data retrieval difficult. type of data remains same.
7 Data integrity The value of data in database must follow or satisfy DBMS maintain the data
some rules or consistency constraints. For e.g. A integrity by enforcing the
company have a policy that the age of an employee constraints by adding
must be >=18. The value which is not satisfying these appropriate code.
constraints must not be stored in the respective column.
In file system, there is no procedure to check these
constraints automatically.
8 Security Problems In file system, there is no or very less security. General DBMS have high level
security provided by file system are locks, guards etc. security like encryption,
passwords, biometric
security(fingerprint
matching, face and voice
detection etc.) etc.
9 Atomicity Atomicity means a transaction must be al-or-nothing Transaction Atomicity is a
i.e. the transaction must either fully happen, or not special feature of DBMS. In
happen at all. It must not complete partially. E.g. if A DBMS either a transaction
wants to transfer 5000 rs to B’s a/c should be credited completed fully or none of
with the same amount. Let suppose A’s a/c is debited the action is performed. For
with 5000 rs and then transaction fails. Now the this, DBMS maintains the
transaction is incomplete because b’s a/c is not credited. transaction log in which
These types of problems occur in file system because intermediate values are
there is no procedure to stop such type of anomalies. stored.
10 Concurrent Access Any multi-user database application has to have some DBMS along with the
Anomalies method for dealing with concurrent access to data— appropriate application
when more than one user is accessing the same data at provides safety towards
the same time. A problem occurs when user X reads a concurrent access. For this
row for editing, user Y reads the same row for editing, locks are available in
user Y saves changes, user X saves changes. The DBMS. If 2 or more
changes made by user Y are lost unless something transactions wants to
prevents user X from blindly overwriting the row. change/update or write a
File system does not provide any procedure to stop such data item, an exclusive lock
type of anomalies. is issued to one of these
transactions. Until and
unless the transaction
releases that lock no other
transactions can acquire the
lock and hence cannot
update/write the data item.