Unit
Unit
Data:
Data is information (or) set of values that has been gathered and translated for some
purpose, usually analysis.
It can be any character, including text, numbers, pictures, sound and video suitable for
use with a computer.
Database
A database is a collection of information that is organized so that it can be easily accessed,
managed and updated.
Database Management System (DBMS)
DBMS is a collection of interrelated data and a set of programs to access those data.
The collection of data, usually referred to as the database, contains information relevant
to an enterprise.
The primary goal of a DBMS is to provide a way to store and retrieve database
information that is both convenient and efficient.
Database systems are designed to manage large bodies of information.
Database-System Applications
Enterprise Information
Sales, Accounting, Human Resources, Manufacturing, Online retailers
Banking and Finance
Credit card transactions, banking, Finance
Universities
course registrations, grades
Airlines
Reservations, scheduling
Telecommunication
prepaid calling cards, monthly bills, bill balance
Unit 1 Page 1
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
redundancy by maintaining a single repository of data that is defined once and is accessed
by many users. As there is no or less redundancy, data remains consistent.
Data sharing: The file system does not allow sharing of data or sharing is too complex.
Whereas in DBMS, data can be shared easily due to a centralized system.
Data concurrency: Concurrent access to data means more than one user is accessing the
same data at the same time. Anomalies occur when changes made by one user get lost
because of changes made by another user. The file system does not provide any procedure
to stop anomalies. Whereas DBMS provides a locking system to stop anomalies to occur.
Data searching: For every search operation performed on the file system, a different
application program has to be written. While DBMS provides inbuilt searching
operations. The user only has to write a small query to retrieve data from the database.
Data integrity: There may be cases when some constraints need to be applied to the data
before inserting it into the database. The file system does not provide any procedure to
check these constraints automatically. Whereas DBMS maintains data integrity by
enforcing user-defined constraints on data by itself.
System crashing: In some cases, systems might have crashed due to various reasons. It
is a bane in the case of file systems because once the system crashes, there will be no
recovery of the data that’s been lost. A DBMS will have the recovery manager which
retrieves the data making it another advantage over file systems.
Data security: A file system provides a password mechanism to protect the database but
how long can the password be protected? No one can guarantee that. This doesn’t happen
in the case of DBMS. DBMS has specialized features that help provide shielding to its
data.
Backup: It creates a backup subsystem to restore the data if required.
Interfaces: It provides different multiple user interfaces like graphical user interface and
application program interface.
Easy Maintenance: It is easily maintainable due to its centralized nature.
Application of DBMS
1. Railway Reservation System
In the rail route reservation framework, the information base is needed to store the
record or information of ticket appointments, status about train’s appearance, and
flight.
3. Banking
Database the executive’s framework is utilized to store the exchange data of the
Unit 1 Page 2
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
4. Education Sector
Presently, assessments are led online by numerous schools and colleges. They deal
with all assessment information through the data set administration framework
(DBMS). In spite of that understudy’s enlistments subtleties, grades, courses,
expense, participation, results, and so forth all the data is put away in the information
base.
Purpose of DBMS
The purpose of DBMS is to transform the following −
Data into information.
Information into knowledge.
Knowledge to the action.
The diagram given below explains the process as to how the transformation of data to
information to knowledge to action happens respectively in the DBMS −
Unit 1 Page 3
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
database; the value of these variables at a moment of time is called the instance of
that database.
DDL Commands
The DDL Commands in Structured Query Language are used to create and modify the
schema of the database and its objects.
1. CREATE Command
2. DROP Command
3. ALTER Command
4. TRUNCATE Command
5. RENAME Command
The DBMS design depends upon its architecture. The basic client/server architecture is
used to deal with a large number of PCs, web servers, database servers and other
components that are connected with networks.
The client/server architecture consists of many PCs and a workstation which are
connected via the network.
DBMS architecture depends upon how users are connected to the database to get their
request done.
Unit 1 Page 4
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user
can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't
provide a handy tool for end users.
o The 1-Tier architecture is used for development of the local application, where
programmers can directly communicate with the database for the quick response.
2-Tier Architecture
o The 2-Tier architecture is same as basic client-server. In the two-tier architecture,
applications on the client end can directly communicate with the database at the
server side. The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query processing
and transaction management.
o To communicate with the DBMS, client-side application establishes a connection
with the server side.
3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server. In this
architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which further
communicates with the database system.
o End user has no idea about the existence of the database beyond the application
server. The database also has no idea about any other user beyond the application.
o The 3-Tier architecture is used in case of large web application.
Unit 1 Page 5
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
Data Independence
o Physical data independence can be defined as the capacity to change the internal
schema without having to change the conceptual schema.
o If we do any changes in the storage size of the database system server, then the
Conceptual structure of the database will not be affected.
o Physical data independence is used to separate conceptual levels from the internal
levels.
o Physical data independence occurs at the logical interface level.
Unit 1 Page 6
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
The relational model uses a collection of tables to repre sent both data and the
relationships among those data. Each table has mul tiple columns, and each column has
a unique name. Tables are also known as relations. The relational model is an example of
a record-based model. Record-based models are so named because the database is
structured in fixed-format records of several types. Each table contains records of a
par ticular type. Each record type defines a fixed number of fields, or attributes. The
columns of the table correspond to the attributes of the record type.
Entity-Relationship Model.
The entity-relationship (E-R) data model uses a collection of basic objects, called entities,
and relationships among these objects. An entity is a “thing” or “object” in the real world
that is distinguishable from other objects.
Object-Based Data Model.
Object-oriented programming (especially in Java, C++, or C#) has become the dominant
software-development methodology. This led to the development of an object-oriented
data model that can be seen as extending the E-R model with notions of encapsulation,
methods (functions), and object identity
Semi-structured Data Model
The semi-structured data model permits the specification of data where individual data
items of the same type may have different sets of attributes. This is in contrast to the data
models mentioned earlier, where every data item of a particular type must have the same
set of attributes.
Unit 1 Page 7
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
The external model is the end users’ view of the data environment. The term end users
refers to people who use the application programs to manipulate the data and generate
information. End users usually operate in an environment in which an application has a
specific business unit focus. Companies are generally divided into several business units,
such as sales, finance, and marketing.
Unit 1 Page 8
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
Each business unit is subject to specific constraints and requirements, and each one uses
a data subset of the overall data in the organization.
Therefore, end users working within those business units view their data subsets as
separate from or external to other units within the organization.
The use of external views representing subsets of the database has some important
advantages:
• It makes it easy to identify specific data required to support each business unit’s
operations.
• It makes the designer’s job easy by providing feedback about the model’s adequacy.
Specifically, the model can be checked to ensure that it supports all processes as defined
by their external models, as well as all operational requirements and constraints.
• It helps to ensure security constraints in the database design. Damaging an entire
database is more difficult when each business unit works with only a subset of data.
• It makes application program development much simpler.
Unit 1 Page 9
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
In other words, the internal model requires the designer to match the conceptual model’s
characteristics and constraints to those of the selected implementation model.
Because the internal model depends on specific database software, it is said to be
software-dependent. Therefore, a change in the DBMS software requires that the internal
model be changed to fit the characteristics and requirements of the implementation
database model.
There are four different types of database-system users, differentiated by the way they
expect to interact with the system .Different types of user interfaces have been designed
for the different types of users.
• Naive users
• Application Programmers
• Sophisticated Users
• Specialized Users
1. Naïve Users
This users are unsophisticated users who interact with the system by invoking one
of the application programs that have been written previously.Parametric End
Users who don’t have any DBMS knowledge but they frequently use the database
applications in their daily life to get the desired results
• Example a clerk in the university who needs to add a new instructor to department
A invokes a program called new hire. This program asks the clerk for the name of
the new instructor, her new ID, the name of the department name , and the salary
• For examples, Railway’s ticket booking users are naive users. Clerks in any bank
is a naive user because they don’t have any DBMS knowledge but they still use the
database and perform their given task.
Unit 1 Page 10
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
test, and maintain set of programs called “canned transactions” for the Naive
(parametric) users in order to interact with database.
3. Sophisticated Users
Sophisticated users interact with the system without writing programs.
Instead they form their requests either using a database query language or by
using tools such as data analysis software. Analysts who submit queries to explore
data in the database fall in this category. Sophisticated users can be engineers,
scientists, business analyst, who are familiar with the database.
4 .Specialized users
They are sophisticated users who write specialized database applications that do
not fit into the traditional data-processing framework. These applications
computer-aided design systems, knowledge base and expert systems, system
that store data with complex data types and environment modeling systems
Example, graphics data and audio data.
Database Administrator
A Database Administrator (DBA) is an individual or person responsible for
controlling, maintaining, coordinating, and operating a database management
system .A person who has central control over the system is called a database
administrator (DBA).
Function of DBA
1. Schema definition. The DBA creates the original database schema by executing
a set of data definition statements in the DDL.
2. Storage structure and access-method definition.
3. Schema and physical-organization modification. The DBA carries out changes to
the schema and physical organization to reflect the changing needs of the
organization, or to alter the physical organization to improve performance
4. Granting of authorization for data access. By granting different types of
authorization, the database administrator can regulate which parts of the database
various users can access. The authorization information is kept in a special system
structure that the database system consults whenever someone attempts to access
the data in the system.
5. Routine maintenance. Examples of the database administrator’s routine
maintenance activities are Periodically backup the database Ensuring that free
enough disk space is available for normal operation Monitoring jobs running on
the database and ensuring the performance is not degraded by very expensive
task submitted by some other user
Unit 1 Page 11
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
DATABASE LANGUAGE
A Database languages are the languages that provide the facility to specify the
database schema and to express database queries and updates. They are further divided
into four categories but all are purposed to provide the facilities in their specific ways and
the most widely used database language is SQL language.
Referential Integrity.
Unit 1 Page 12
Course code –18CSC303/ Course Name-DBMS Department & Semester: CSE/VI
There are cases where we wish to ensure that a value that appears in one
relation for a given set of attributes also appears in a certain set of attributes in
another relation (referential integrity). For example, the department listed for each
course must be one that actually exists. More precisely, the dept name value in a
course record must appear in the dept name attribute of some record of the
department relation. Database modifications can cause violations of referential
integrity. When a referential-integrity constraint is violated, the normal procedure
is to reject the action that caused the violation.
Assertions. An assertion is any condition that the database must always satisfy.
Domain constraints and referential-integrity constraints are special forms of
assertions. However, there are many constraints that we cannot express by using
only these special forms. For example, “Every department must have at least five
courses offered every semester” must be expressed as an assertion. When an
assertion is created, the system tests it for validity. If the assertion is valid, then any
future modification to the database is allowed only if it does not cause that assertion
to be violated.
Authorization. We may want to differentiate among the users as far as the type of
access they are permitted on various data values in the database. These
differentiations are expressed in terms of authorization, the most common being:
read authorization, which allows reading, but not modification, of data; insert
authorization, which allows insertion of new data, but not modification of existing
data; update authorization, which allows modification, but not deletion, of data;
and delete authorization, which allows deletion of data. We may assign the user all,
none, or a combination of these types of authorization.
2.Transaction Control Language
• It is used to manage the transactions in the database. The functions performed by
DML are further managed by this language.
• It allows the statements to be grouped together into logical transactions.
• TCL performs the following tasks:
Commit: It is used to save the transaction in the database.
Rollback: It is used to restore the database to the last committed state.
Save point: It is used to store the transaction temporarily such that one can easily rollback
to the transaction when needed
3.Data Control Language
• It provides the facility of the authorization in the database. All the commands used
in DDL and DML can further be authorized with DCL.
• The drawback of DCL is that one cannot rollback the command as DCL allows
only implicit commit.
• This mainly occurs in Oracle Database. Some of the commands of DCL are:
Grant: It allows only specific user to perform specific tasks.
Revoke: It allows the cancellation of the previously granted permissions or the denied
one.
Unit 1 Page 13