Download as pdf or txt
Download as pdf or txt
You are on page 1of 44

Database Management System

Chapter – 1
Introduction to Database Management System

1) What is DBMS? [2012, 2014, 2015, 2016]


Ans:- DBMS is collection of programs that enables users to create and maintain a
database. The DBMS is general purpose software system that facilitates the process of
defining, constructing, manipulating and sharing the databases.
- This collection of related data is termed as ‗Database‘.
- In short, DBMS allow users to create and maintain a database.

2) Explain the characteristics of DBMS. [2012, 2014, 2015, 2016]


Ans: 1) Self-describing nature of a database system: A fundamental characteristic of
the database approach is that the database system contains not only the database itself but
also a complete definition or description of the database structure and constraints.
- This definition is stored in the DBMS catalogue, which contains information such as the
structure of each file, the type and storage format of each data item, and various
constraints on the data.
- The information stored in the catalogue is called meta-data and it describes the structure
of the primary database.
- DBMS is being developed as general- purpose software package and it is not written for
specific database application.

2) Insulation between programs and data, and data abstraction:- Database approach
ensures program- data independence. A characteristic that permits programs-data
independence is termed as ―Data Abstraction‖ accordingly; the data model is type of data
abstraction.
- DBMS provides users with the conceptual representation of data that does not include
many of the details of how data is stored and implemented.

3) Support of Multiple Views of the Data: - A database typically has many users, each
of whom may require a different view of the database. A view may be a subset of the
database or it may contain virtual data. That is derived from the database files but is not
explicitly stored.
- Some users may not need to be aware of whether the data they refer to is stored or
derived.
- The multiuser DBMS whose users have a variety of distinct applications must provide
facilities for defining multiple views.

4) Sharing of Data and Multiuser Transaction Processing: A multiuser DBMS, as its


name implies, must allow multiple users to access the data-base at the same time.
- This is essential if data for multiple applications is to be integrated and maintained in a
single database.

1
Written By: Mahesh, Nitin, Sunil.
Database Management System

- DBMS must include ―Concurrency Control‖ when multiple applications access same
sets of data simultaneously (multi user DBMS) and also it is software to ensure that
several users trying to update the same data do so in a controlled manner so that the result
of the updates is correct
- For example, when several reservation clerks try to assign a seat on an airline flight, the
DBMS should ensure that each seat can be accessed by only one clerk at a time for
assignment to a passenger.
- These types of applications are generally called ‗Online transaction process (OLTP)‘.

3) Who are Actors on the Scene? Explain in detail the roles of each actor in DBMS.
[2012, 2014, 2015]
Ans: - The people involved in the design, use and maintenance of large database with
hundreds of users. We called them as Actors on the Scene.

Actors are:
1) Database Administrators: - The DBA is responsible for authorizing access to the
database, coordinating and monitoring its use and acquiring software and hardware
resources as needed.
- DBA is single person to manage the databases of typically large establishments. He has
administered the co-ordinate use of resource of database system environment.
Functions of DBA: - a) Authorize access to database.
b) Facilitate co-ordinate use of database.
c) Install an upgrade DBMS and application Tools.

2) Database Designers: - Database designers are responsible for identifying the data to
be stored in the database and for choosing appropriate structures to represent and store
this data.
- It is the responsibility of database designers to communicate with all prospective
database users in order to understand their requirements and to create a design that meets
these requirements.
- Database designers develop and finalize database model and database designers must
ensure that the proposed model is capable of supporting real-world system in many
aspects.
Database designers typically interact with each potential group of users and develop
views of the database that meet the data and processing requirements of these groups.

3) End Users:- These are the people whose jobs is to access the database for querying,
updating, and generating reports, the database primarily exist for their use.

2
Written By: Mahesh, Nitin, Sunil.
Database Management System

Types of End users:


a) Casual end users: - occasionally, access the database, but they may need different
information each time. They use a sophisticated database query language to specify their
requests, and are typically middle- or high-level managers or other occasional browsers.

b) Parametric end users: - This makes up a sizable portion of database end users. Their
main job function revolves around constantly querying and updating the database, using
standard types of queries and updates—called canned transactions—that have been
carefully programmed and tested. The tasks that such users perform are varied:
- A Bank tellers check account balances and post withdrawals and deposits. Reservation
clerks for airlines, hotels, and car rental companies check availability for a given request
and make reservations.

c) Stand-alone end users: - Maintain the personal database by using readymade program
package that provide easy-to-use provided by the DBMS.
For example: Income tax assessment software package- to file tax return on annual
income of an individual.

d) Sophisticated End User: include engineers, scientists, business analysts and other
who thoroughly familiarize themselves with the facilities of the DBMS in order to
implement applications to meet complex requirements.

Workers behind the Scene:


1) DBMS System designers & implementers: The people are design, develop and
implement various modules of DBMS software package.
- They also these DBMS modules as a general purpose software package. They
implement DBMS interface with its operational system environment via operating system
& compilers associated with one or more languages applications.

2) Tool Developers: - This is person who develops and implements various software
tools & utilities that help assist the database, testing and its trial usages for performance
monitoring.

3) Operators and maintenance personnel: This person who conduct execution


operation and maintenance activities of the actual hardware and software environment
surrounding the database system.

4) Explain Advantages of DBMS.


Ans: - 1) Controlling Redundancy
2) Providing Security
3) Providing Persistent storage for program objects
4) Providing Storage structure for data

3
Written By: Mahesh, Nitin, Sunil.
Database Management System

5) Providing Back-up and Recovery


6) Providing multiple user access
7) Represent Complex relationship among data
9) Restricting Unauthorized Access.

5) Explain “When not to use DBMS”. [2014]


Ans:- In spite of the advantages of using a DBMS, there are a few situations in which
such a system may involve unnecessary overhead costs as that would not be incurred in
traditional file processing.
1) High initial investment in hardware, software, and training.
2) The generality that a DBMS provides for defining and processing data.
3) Overhead for providing security, concurrency control, recovery, and integrity
functions.
4) Simple, well defines database applications that are not expected to change.
5) Real-time requirement are not met because of overhead of DBMS.
6) No multiple-user access to data.

4
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter – 2
Database System Concepts and Architecture

1) What is Data model? Discuss the different categories of data models.


[2012, 2014, 2016]
Ans: - Data model is collection of concepts that can be used to describe the structures of
a database.
Categories of data models:- The Data Models describe the availability of services to an
interfacing application as how to access a data item when other relevant data items are
known.

i) Low level or Physical data models: They provide concepts about physical storage of
data i.e. how to store data in a computer hard disk. They specify about record formats,
record ordering and access paths etc.
- Low level data model details are generally meant for computer scientists, not for typical
end users.
- This data models make search for a particular database in DBMS
Examples: Heaps, ISAM, VSAM, and Hash.
-Foreign keys are used to identify relationships between tables.

ii) High level or Conceptual data model: These models are also referred as Logical data
models. They provide concepts for typical end users at high level i.e., that are
independent of physical storage.
- Conceptual data model use concept such as entities, attributes and relationships.

Entity: It represents Real-Word object or concept or Real-thing. Such as employee or


project, that describe in the database.

Attribute: It represent the some properties of entity such as employee‘s salary or name.
- Accordingly, High level data models provide concepts such as entities, attributes,
relationship and data structures etc. High level data model details can be easily
understood by typical end users.
- The context of data models categories give rise to third variety of data models called
‗Representational data models‘. They are also termed as Implementation models.
- These representational data model can broadly be considered as belong to High level or
logical data models as they provide concepts that may be easily understood by end users.

iii) Representational or Implementation Data model: It refers to concepts and here the
data are not changed, that are fixed & this cannot be re-implemented by end-users.
- This models are used most frequently in traditional commercial DBMSs. These include
widely used relational data model.

5
Written By: Mahesh, Nitin, Sunil.
Database Management System

3) Define: a) Database Schema [2014, 2016]


b) Database State [2014]
Ans:- a) Database Schema:- The notation of the database representation or simply
description of a database is referred to as database schema.
b) Database State:- A data in the database at a particular moment in time called database
state or Instance.

4) Explain Three-Schema Architecture with neat diagram. [2014, 2015, 2016]


Ans:- The goal of the three-schema architecture is to separate the user applications and
the physical database.

- In this architecture, schemas can be defined at the following three levels:

a) The Internal schema at physical level (internal level):- It is lowest level of data
abstractions defining the physical storage structure of the database.
- Which describes the physical storage structure of the database. The internal schema uses
a physical data model and describes the complete details of data storage and access paths
for the database.

b) Logical level at Conceptual schema (conceptual level):- It is next higher level of


data abstraction which describes the structure of the whole database for a community of
users.
- The conceptual schema hides the details of physical storage structures and concentrates
on describing entities, data types, relationships, user operations, and constraints.
6
Written By: Mahesh, Nitin, Sunil.
Database Management System

- Usually, a representational data model is used to describe the conceptual schema when a
database system is implemented. This implementation conceptual schema is often based
on a conceptual schema design in a high-level data model.

c) The external schema at View level (External level): It is highest level of abstraction
defining only part of database.
- It includes a number of external schemas or user views. Each external schema describes
the part of the database that particular user group is interested in and hides the rest of the
database from that user group.
- This level of abstraction simplifies end user‘s interaction with database system.

5) Define Data Independence and Explain Logical and Physical data independence.
Ans: - Data Independence:- It is defined as the capacity to change the schema at one
level of a database system without having to change the schema at the next higher level.

1) Logical Data Independence: - It is the capacity to change the conceptual schema


without having to change external schemas or application programs.
- We may change the conceptual schema to expand the database (by adding a record type
or data item), to change constraints, or to reduce the database (by removing a record type
or data item).
- Consider the example of student database. The schema constructs for student entity may
further modified by appending 2 or more attributes fields such as PERCENTAGE and
GRADE.
- For such modifications at conceptual schema level, the logical data independence
accommodates these changes.

2) Physical Data Independence: - It is defined as the capacity to change internal schema


without having to change the conceptual schema.
- For example: Physical changes to database or internal schema may include changing
access technique to improve the performance of database retrieval.
- Physical Data independence permits tuning of the physical database for performance
reason while allowing respective application programs to run as if no change had taken
place.

6) Explain all DBMS Languages (DDL, DML, SDL, and VDL). [2012, 2015, 2016]
Ans: - i) DDL (Data definition languages):- It is used by DBA and by database
designers to define to define both schemas.
- The DBMS will have DDL compiler whose function is to process DDL statement in
order to identify description of schema and to store the schema description in DBMS
catalog.
- CREATE - to create objects in the database
- ALTER - alters the structure of the database

7
Written By: Mahesh, Nitin, Sunil.
Database Management System

- DROP - delete objects from the database


- TRUNCATE - remove all records from a table, including all spaces allocated for the
records are removed
- COMMENT - add comments to the data dictionary
- RENAME - rename an object

ii) DML (Data manipulation language):- Statements are used for managing data within
schema objects.
- Typical manipulations include retrieval, insertion and deletion of data. The DBMS
provides set of operations or languages called Data manipulation language (DML).
- SELECT - Retrieve data from the database
- INSERT - Insert data into a table
- UPDATE - Updates existing data within a table
- DELETE - deletes all records from a table

iii) SDL (Storage Definition Language):- It is used to specify the internal schema. The
mapping between two schemas may be specified in either one of these languages.

iv) TCL (Transaction Control Language):- Statements are used to manage the changes
made by DML statements. It allows statements to be grouped together into logical
transactions.
Some examples:
- COMMIT - Save the work permanently
- SAVEPOINT - identify a point in a transaction to which you can later roll back
- ROLLBACK - restore database to original since the last COMMIT.

v) DCL (Data Control Language):


some examples:
- GRANT - gives user's access privileges to database
- REVOKE - withdraw access privileges given with the GRANT command.

7) Explain DBMS Interfaces. [2016]


Ans: - 1) Menu-Based Interfaces for Web Clients or Browsing.
- These interfaces present the user with lists of options (called menus) that lead the user
through the formulation of a request.
- Menus do away with the need to memorize the specific commands and syntax of a
query language; rather, the query is composed step-by-step by picking options from a
menu that is displayed by the system. Pull-down menus are a very popular technique in
Web-based user interfaces.
- They are also often used in browsing interfaces, which allow a user to look through the
contents of a database in an exploratory and unstructured manner.

8
Written By: Mahesh, Nitin, Sunil.
Database Management System

2) Form Based Interlaces.


- A forms based interface displays a form to each user. Users can fill out all of the form
entries to insert new data, in which case the DBMS will retrieve matching data for the
remaining entries.
- Forms are usually designed and programmed for naive users as interfaces to canned
transactions.
- Many DBMSs have forms specification languages, which are special languages that
help programmers, specify such forms. SQL*Forms is a form-based language that
specifies queries using a form designed in conjunction with the relational database
schema.

3) Graphical User Interfaces:


A GUI typically displays a schema to the user in diagrammatic form. The user then can
specify a query by manipulating the diagram.
- In many cases, GUIs utilize both menus and forms. Most GUIs use a pointing device,
such as a mouse, to pick certain parts of the displayed schema diagram.

4) Natural Language Interfaces.


- These interfaces accept requests written in English or some other language and attempt
to understand them.
- A natural language inter-face usually has its own schema, which is similar to the
database conceptual schema, as well as a dictionary of important words.
- The natural language interface refers to the words in its schema, as well as to the set of
standard words in its dictionary, to interpret the request.
- The capabilities of natural language interfaces have not advanced rapidly.

5) Speech Input and Output.


- The speech input is detected using library words and used to set-up parameters that
separate the queries.
Ex: Telephone Directories.
- Limited use of speech as an input query and speech as an answer to a question or result
of a request is becoming commonplace.
- Applications with limited vocabularies such as inquiries for telephone directory, flight
arrival/departure, and bank account information are allowing speech for input and output
to enable ordinary folks to access this information.

8) Explain DBMS Languages. [2012, 2015, 2016]


Ans: a) DDL (data definition language):-It is used to define the schemas. It is used by
DBA and by database designers to define both schemas.
- The DBMS will have DDL compiler whose function is to process DDL statements in
order to identify descriptions of schema in DBMS catalog.

9
Written By: Mahesh, Nitin, Sunil.
Database Management System

b) SDL (Storage definition language):- It is used to specify the internal schema and
SDL is used to store the internal schema.
- In most of the relational DBMS today, there is no specific language that performs the
role of SDL, instead, the internal schema is specified by combination of parameters and
specifications related to storage.

c) VDL (View definition Language):- It is to specify user views and their mappings to
the conceptual schema.SQL are used in the VDL to define user or applications views as
results of predefined queries.

d) DML (data manipulation Language):- Typical manipulations include retrieval,


insertion, deletion and modification of data. The DBMS provide set of operation called
Data Manipulation Language.
- There are two types of DML‘s High level or non-procedural DML.
- DML statements must be identified within a program so that they can be extracted by
pre-compiler & processed by DBMS.

9) Explain Database System (DBS) Environment with neat diagram.


Ans:-

DBMS component modules:


Above figure illustrates the DBMS components. The figure is divided into 2 halves. The
top half of the figure refers to various users of database environment.
- The lower half shows the internal of the DBMS responsible for storage of data.
10
Written By: Mahesh, Nitin, Sunil.
Database Management System

The components are listed below:


i) Query compiler: - It performs translation of high SQL into database access code and
generates appropriate calls to run-time processor to execute code.
ii) Stored Data manager (storage manager):- High level stored data manager
component module of DBMS, which define an interface between low-level data stored in
database.
- It is responsible for the interaction with the file manager.
File manager: - it is to manage the memory allocation on disk storage and data
dictionary that represent Meta data.
Buffer Manager: - It is to manage fetching of data from hard disk storage units into
main memory of computer.
ii) DDL compiler: - It performs translations of DDL statements into schema definitions
and store corresponding schema descriptions called meta data in DBMS catalog.
iii) DML compiler: - The SQL statements hence extracted by pre-compiler are submitted
to DML compiler. It will translate them into database access and manipulation.
- This object code is for extracted DML/SQL statements and parts of SQL. It is to form
one or more canned transactions.
iv) Pre compiler: - It will identify the SQL statements/ DML statements in host language
applications program.
v) Stored database and system/ catalog: - The database and the DBMS- catalog are
usually stored on Hard disk.

10) Explain the classification of Database management system (DBMS). [2016]


Ans:- i) Relational Data model
ii) Object data model
iii) Hierarchical data model
iv) Legacy data model.

11
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter – 3
Data Modeling using Entity- Relationship Model

1) Notations of ER-Diagram. [2012, 2016]

2) What is ER model?
Ans:- It is high level conceptual data model. This model & its variations are frequently
used for the conceptual design of database applications.ER model is used to represent
Real-World objects called entities.

3) Explain Entity, Entity types, Entities sets, Attributes and Keys: [2012, 2015]
Ans:- a) Entities:- An entities can be any object place, person, house, car, employee and
class.
-It represents using the rectangular box.
b) Entity SET: It is a set of entities of the same entity type. So a set of one or more
Entities of Student Entity type is an Entity Set.
For example: in table STUDENT id, name and Age are properties of an entity of entity
type student. Hence these are attributes.

12
Written By: Mahesh, Nitin, Sunil.
Database Management System

c) Entities type: It is a collection of an entity having a common attribute. As in Student


table, each row is an entity and has common attributes.
- So STUDENT is an entity type which contains entities having attributes id, name and
Age.
d) Weak Entity type: When an entities set or entity type does not have their own key
attributes to form a primary key then they are termed as weak entity set.
A weak entity type is said to have total participation relationship constraint with that of
its owner entity type.
Sometimes, weak entities are referred to as child entity types or subordinates entity types.
To conclude, weak entities cannot identify itself without its parent or owner entity type.
An Entity set having a primary key is termed as a strong entity or dominant entity set.

4) Explain Attributes and types of attributes: [2014]


Ans:- ATTRIBUTE: It is a property of an entity or Attribute which describes the entity.
- For example, in table STUDENT id, name and Age are properties of an entity of entity
type student. Hence these are attributes.

Types of Attributes:
a) Simple attribute: - Simple attributes are atomic values, which cannot be divided
further into subparts.
For example:- A student's phone number is an atomic value of 10 digits.

b) Composite attribute:-These can be divided into smaller subparts, which represent


more basic attribute with independent meaning.
- For example, a student's complete name may have first_name and last_name.

13
Written By: Mahesh, Nitin, Sunil.
Database Management System

c) 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.

d) Single-valued attribute:- Single-valued attributes contain a single value for particular


entity.
For example: Age is single-valued attribute.

e) Multi-valued attribute:- Multi-valued attributes may contain more than one values.
For example:- A person can have more than one phone number, email address, etc..

f) Key Attribute:- The key attribute represents the main characteristic of an Entity. It is
used to represent the Primary key. Oval shaped with underlying lines represent Key
Attribute.

14
Written By: Mahesh, Nitin, Sunil.
Database Management System

g) Complex Attribute: A complex attribute exist when nesting and /or grouping of
composite attribute along with multi-valued attribute takes place.
For example:- A company CEO has multiple contact phone no at one or more locations.
So locations address as composite attribute and contact phone no valued to be displayed
(with braces{}).

5) Explain Relationship and Relationship types.


Ans:- A Relationship describes relations between entities. The relationship is represented
using diamonds.
Binary Relationship: A relationship where two entities are participating is called
a binary relationship.

There are three types of relationship that exist between Entities.


-Binary Relationship
-Recursive Relationship
-Ternary Relationship

- Relationships are represented by a diamond-shaped box. Name of the relationship is


written inside the diamond-box. All the entities (rectangles) participating in a
relationship, are connected to it by a line.

6) What is Cardinality Ratio? Explain 4 different types to Cardinality Ratio in


binary relationship.
Ans:- Cardinality is the number of instance of an entity from a relation that can be
associated with the relation.

4 different types to Cardinality Ratio‟s:


a) One-to-one(1:1): When only one instance of an entity is associated with the
relationship, it is marked as '1:1'. The following image reflects that only one instance of
each entity should be associated with the relationship. It depicts one-to-one relationship.

15
Written By: Mahesh, Nitin, Sunil.
Database Management System

b) One-to-many: When more than one instance of an entity is associated with a


relationship, it is marked as '1:N'. The following image reflects that only one instance of
the entity on the left and more than one instance of an entity on the right can be
associated with the relationship. It depicts one-to-many relationship.

c) Many-to-one: When more than one instance of an entity is associated with the
relationship, it is marked as N:1'.

d) Many-to-many: An entity of entity set is associated with two or more entities of


entity. For example: a doctor has many patients to diagnose on disease. It depicts many-
to-many relationship.

16
Written By: Mahesh, Nitin, Sunil.
Database Management System

7) Explain ER- diagram for Company Database.


Ans:-

17
Written By: Mahesh, Nitin, Sunil.
Database Management System

8) Explain degree of relationship type


Ans:- The degree of relationship define the number of entity types associated with that
relationship type.

a) Unary:- Relationship of degree one .


Ex: For instance when participating entity is one.

b) Binary:- Relationship of degree two are termed as Binary. It involved two entity
types.
Ex:- faculty member have specification in qualification of engineering courses. Such as
CS, Is E&C etc…

c) Ternary:- Relationship of degree Three


Ex: For instance medical representative supply newly arrived medicines to one or more
medical shops in a city.

d) Quartrnary:- Relationship of degree Four.


Ex: Faculty members teaches a particular subject to class of student at a class room.

e) n-ary:- Relationship of degree more than one entity or attribute.


Ex: Company Database.

18
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter – 4
Record Storage and File Organization

1) What is a File? [2012]


Ans:- A file is a sequence of records. In many cases, all records in a file are of the same
record type. If every record in the file has exactly the same size (in bytes), the is said to
be made up of fixed-length records.

Operations on Files: [2012, 2014, 2015]


1) Open:- Prepares the file for reading or writing. Allocates appropriate buffers (typically
at least two) to hold file blocks from disk, and retrieves the file header. It sets the file
pointer to the beginning of the file.
2) Reset:- Sets the file pointer of an open file to the beginning of the file.
3) Find (or Locate):- Searches for the first record that satisfies a search condition.
Transfers the block containing that record into the main memory buffer (if it is not
already there).
4) Read:- Copies the current record from the buffer to a program variable in the user
program.
5) Delete:- Deletes the current record and updates the file on disk to reflect the deletion.
4) Modify:- Modifies some valuesold e for the current record and (even updates the file
on disk to reflect the modification.
6) Insert:- Inserts the new records in file by locating block where record is to be inserted,
transferring that block into main memory.

2) What is Fixed length and Variable length variable in Files? [2012]


Ans:- Fixed length:- If every record in the file has exactly the same size(in byte) the file
is said to be made up of ‗Fixed Length records‘.
Variable length:- If different records have different sizes, the file is said to be made-up
of variable length of records

3) Explain the concept of Heap Files. [2014]


Ans:- It facilitates accessing any records directly or randomly without having to traverse
the sequence of records. These files are also known as random or relative files.
- Only one item can be accessed at a time. That item may be stored anywhere in the file.
-Records are placed in the file in the order in which they are inserted, so new records are
inserted at the end of the file. Such an organisation is called a Heap.
- Inserting a new record is very efficient. The last disk block of the file is copied into a
buffer, the new record is added, and the block is then rewritten back to disk.
- The address of the last file block is kept in the file header. However, searching for a
record using any search condition involves a linear search through the file block by
block—an expensive procedure.

19
Written By: Mahesh, Nitin, Sunil.
Database Management System

- For Heap file ‗fixed-length‘ records using un-spanned blocks it is straight forward
approach to access any record by its position in the file.

4) Explain the concepts of Sorted Files (Ordered Files).


Ans:- We can physically order the records of a file on disk based on the values of one of
their fields - called the ‗Ordering field‘.
- This leads to an ordered or sequential file. If the ordering field is also a key field of the
file- a field guaranteed to have a unique value for each record-then the field is called the
ordering key for the file.
- Ordered records have some advantages over unordered files. First, reading the records
in order of the ordering key values becomes extremely efficient because no sorting is
required.
- Second, finding the next record from the current one in order of the ordering key
usually requires no additional block accesses.
- Sorted files are rarely used database applications unless an additional access path, called
primary index.

5) What is Hashing Technique? Explain Internal and External Hashing.


[2014, 2015, 2016]
Ans:- It which provides very fast access to records under certain search conditions. This
organisation is usually called a hash file.
-The search condition must be an equality condition on a single field, called the Hash
field.
- In most cases, the hash field is also a key field of the file, in which case it is called the
Hash key. The idea behind hashing is to provide a function h, called a ‗Hash function‘ or
‗randomizing function‘, which is applied to the hash field value of a record address of the
disk block in which record is stored.

Types of Hashing Technique:


1) Internal Hashing:-
- For internal files, hashing is typically implemented as a hash table through the use of an
array of records. Suppose that the array index range is from 0 to M – 1, then we have M
slots whose addresses correspond to the array indexes.
- We choose a hash function that transforms the hash field value into an integer between
0 and M – 1. One common hash function is the h(K) = K mod M function, which returns
the remainder of an integer hash field value K after division by M; this value is then used
for the record address.

Algorithm
It can be used to calculate the hash address.

20
Written By: Mahesh, Nitin, Sunil.
Database Management System

Algorithm: - Two simple hashing algorithms:


Applying the mod hash function to a character string K. (b) Collision resolution by open
addressing.
(a) temp 1;
for I 1 to 20 do temp +– temp * code(K[i ) mod M ;
hash_address temp mod M;

(b) i,hash_address(K); ai;


if location i is occupied then begin i (i + 1) mod M; while (i 0 a) and location i is
occupied doi (i + 1) mod M;
- A collision occurs when the hash field value of a record that is being inserted hashes to
an address that already contains a different records. In this situation, we must insert new
record in some other position is called collision resolution.
- The goal of good hashing function is to distribute the records uniformly over the
address space as to minimize collision.

2) External Hashing:- Hashing for disk file is called external hashing. To suit the
characteristics of disk storage, the target address space is made of Buckets. Each of which
holds multiple records.
- A bucket is either one disk block or cluster of contiguous block. The hashing function
maps the key into relative bucket number.
- The collision problem is less severe with buckets, because as many records as will fit in
bucket can hash to the same bucket without causing problem.
- The pointer in the linked list should be records pointers, which include both a block and
relative record position within a block.
- Hashing provides fastest possible access for retrieving arbitrary record given value of its
hash field.

6) Explain RAID technology with their levels. [2015]


Ans:- RAID Techonology
- A major advance in secondary storage technology is represented by the development of
RAID, which originally stands for „Redundant Arrays of Inexpensive Disks‟.
The RAID idea received a very positive industry endorsement and has been developed
into set of alternative RAID architecture.

Data stripping:- It utilizes the parallelism to improve disk performance. Data stripping
distribute data transparency over multiple disks to make them appear as single large, fast
disk.

21
Written By: Mahesh, Nitin, Sunil.
Database Management System

Levels of RAID Technologies


- Different RAID organizations were defined based on different combinations two factors
of granularity of data interleaving (striping) and pattern used to compute redundant
information.
- In the initial proposal, levels 1 through 5 of RAID were proposed, and two additional
levels-0 and 6—were added later.
- RAID level 0 uses data striping, has no redundant data and hence has the performance
since updates do not have to be duplicated.
- However, its read perform-man is not as good as RAID level 1, which uses mirrored
disks.
- In the latter, performance improvement is possible by scheduling a read request to the
disk with shortest expected seek and rotational delay.
- RAID level 2 uses memory-style redundanancy by using Hamming codes, which
contain parity bits for distinct overlapping subsets of components.
- RAID level 3 uses a single parity disk relying on the disk controller to figure out which
disk has failed.
- Levels 4 and 5 use block-level data striping, with level 5 distributing data and parity
information across all disks.
- Finally, RAID 6 applies the so-called P + Q redundancy scheme using Reed-Soloman
codes to protect against up to two disk failures by using just two redundant disks.
- The seven RAID levels (0 through 6) are illustrated in below figure schematically.

7) Explain New Storage Systems (SAN and NAS).


Ans:- New Storage Systems:- In this section, we describe two recent developments in
storage systems that are becoming an integral part of most enterprise's information
system architectures.
1) Storage Area Network:- With the rapid growth of electronic commerce, Enterprise
Resource Planning(ERP) systems that integrate application data across organisations, and

22
Written By: Mahesh, Nitin, Sunil.
Database Management System

data ware houses that keep historical aggregate information, the demand for storage has
gone up substantially.
- Many users of RAID system cannot use the capacity effectively because it has to be
attached in a fixed manner to one or more server. Therefore, large organizations are
moving to concept called ‗Storage Area Network‘.
- In SAN online storage peripherals are configured as nodes on a high-speed network and
can be attached & detached from servers in very flexible manner.

Advantages of SAN:
i) Flexible many-to-many connectivity among servers and storage devices using fibre
channel hubs
ii) up to 10 km separation between capabilities between a server and storage system using
appropriate fiber optic cables.

2) Network Attached Network (NAS):- NAS devices allow vast amount of hard disk
storage space to add to network and can make that space available to multiple servers
without shutting them down for maintenance and upgrades.
- The need for high performance storage at low cost has become extremely important.
Network-attached storage (NAS) devices are used for this purpose.
- NAS devices reside anywhere in on LAN and may be combined in different
configurations.
- A single hardware device, often called NAS box or NAS head, acts as interface between
NAS system and network Clients.
- This NAS devices require no monitor, keyboard or mouse. One or more disk or tapes
drivers can be attached to many NAS systems to increase total capacity.

8) Explain Secondary storage Devices [2016]


Ans:- Classified into two types:
i) Sequential Access Device ii) Direct Access Device
Ex:- Magnetic Tape Ex: Magnetic Disk

i) Magnetic Disk:- This are used storing large amount of data. The most basic unit of
data on the disk is single bit of information. All disks are made of magnetic material
shaped as a thin circular disk, as shown below diagram.
Diagram:

23
Written By: Mahesh, Nitin, Sunil.
Database Management System

- A disk is single sided if it stores information on one of its surfaces only and double-
sided if both surfaces are used.
- Each circle is called track. In packs, tracks with the same diameter on the various
surfaces are called as cylinder because of shape.
- The number of tracks on the disk ranges from few hundred to a few thousand, and
capacity of each track ranges from tens of Kbytes to 150 Kbytes.
- The division of track into sectors is hard-coded on the disk surface and cannot be
changed.
-The division of track into equal-sized disk block is set by the operating during disk
formatting.
- The actual hardware mechanism that reads or writes block is disk read/write head,
which is part of system called disk drive.
- Contiguous blocks called a cluster.

ii) Magnetic Tape:- It looks like tape used in ‗Music Cassets‘ it is plastic tape with a
magnetic coating on it. The data stored in form of tiny segments of magnetized and
de- magnetized portions on the surface of material.
- Magnetic tapes are sequential access devices; to access the nth block on the tape.
- Data records on the tape are also stored in blocks. The main characteristic of tape is its
requirement that we access the data blocks in sequential order.
- Magnetic portion refers to value 1. and de-magnetic portion refers to value 0.
Different sizes: a) ½ inches wide tape
b) ¼ inches wide tape
- Magnetic tape units:- This are capable of reading and writing data.
- Speed: 50 inches/sec> speed > 100 inches /sec
Advantages:
1) Durable and reused
2) Least expensive
3) It is reliable storage medium
4) Data transfer can be increasing speed of the tape.

24
Written By: Mahesh, Nitin, Sunil.
Database Management System

Disadvantages:
1) It needs to be Revised or updated often
2) It needs to be Rewind the tape to the position where required data starts.
3) It is slow.

9) Explain Buffering of Blocks. [2012, 2015]


Ans:- Interleaved Concurrency Vs Parallel Execution:

- Process A & B are running concurrently in an interleaved fashion, where as C & D


process are running concurrently in a parallel fashion.
- When a single CPU controls multiple processors that runs concurrently in an interleaved
way.
- Buffering is most useful when processors can run concurrently in a parallel manner.
Either because a separate disk I/O processors is available. Because multiple CPU exist.

Use of two buffers A and D reading from disks


- When time required two processors a disk block memory is less than time required to
read the new- block & till a buffer.
- CPU can start processing a block once. Its transferred to main memory is completed.
- At the same the disk I/O processor can be reading & transferring the next block into
different buffer this technique called ‗Double Buffering‖

Advantages:- 1) Reduce the waiting time in program.

25
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter – 5
Functional Dependencies and Normalization for Relation Database

1) Discuss Informal Design Guidelines for Relation Schemas. [2012]


Ans:- We have four important informal measures of quality for relation schema design.
They are as follows:
1) Semantics of the Attributes:- The semantics of relation refers to the interpretation of
attribute values in a tuples.
- We know that an entity (forming a relation) is an object or concept and can be define as
a collection one or more of its attributes.
- For instance STUDENT, EMPLOYEE, DRUGS, Etc… all entities leading to relation
schemas.
- For example, a STUDENT relation is defined by grouping of attributes such as REG-
NO, NAME AGE, CLASS, etc.. where in some amount of meaning is associated with
each and every attribute of individual STUDENT tuples.

2) Reducing the Redundant Values in Tuples:- The goal of this schema is to minimize
the storage space used by the base relation.
- Grouping attributes into relation schemas has a significant effect on storage space.
- Optimum storage utilization is another important objective of designing and storing
relation schemas as base relations (base tables or files).
- That is storage space should not be consumed unnecessarily for storing redundant data.
- For instance, consider the following two relation schemas as EMPLOYEE and
DEPARTMENT.
- A new relation schema called DEPT_EMPLOYEES is formulated by a grouping of
attributes drawn from both EMPLOYEE and DEPARTMENT relation schemas. This is
shown in figure. EMPLOYEE:
EMP -NO NAME DOB SALARY ADDRESS DEPT-ID

DEPARTMENT:
DEPT-NUM DEPT-NAME HOD-ID DEPT-LOCATION.

DEPT-EMPLOYEES:
EMP -NO NAME DOB SALARY DEPT-ID DEPT-NAME DEPT-LOCATION
- The relation DEPT-EMPLOYEES would cause serious redundancy storage problem if
atleast 5 to 10 employees are working in each (different) department.
- That is for ‗n‘ number of employees working for the same department the values for
DEPT-ID, DEPT-NAME and DEPT-LOCATION remains same and will be repeated n
times!!

26
Written By: Mahesh, Nitin, Sunil.
Database Management System

EMP_DEPT:
Ename Ssn Bdata Address Dno Dname Dmgr_ssn
Rajesh 234346 09-02-1990 #736 Hosur 6 Research 333444666
Shyam 72772 8-07-1997 Gdg 6 Research 333444666
Ram 999888 17-04-1993 #a, Haveri. 4 Admin 783387383
Subhas 983363 30-09-1990 331, castilerock 4 Admin 44332222
987, rice
Houstn

Update Anomalies:-
- The Update anomalies can be classified as:
i) Insertion Anomalies:- Insertion anomalies can be differentiated into 2 types
- To insert new employee tuple into EMP_DEPT, we must include either the attribute
values for the dept that employee works for, or NULL.
- For example, to insert new tuple for an employee who works in dept number 4, we must
enter attribute values of dept 4 correctly so they consistent with values for dept 4 in other
tuples in EMP_DEPT.

- Similarly, it is difficult to enter new department details (newly recruited) in


DEPT-EMPLOYEES relation, wherein for such employees yet the department has not
been allocated.
- The only way to do this to place NULL value in the attribute for employee.

ii) Deletion Anomalies: Assuming a single employee is working for the department such
as RESEARCH, while other tuples have been deleted previously.
- Now deleting this last tuple also erases the existence of a particular department from
DEPT-EMPLOYEES relation.
- Such irregularity may not occur in the database of above figure is employed. Since
tuples pertaining to department exist separately in DEPARTMENT table although none
of the employees is working for it.

iii) Update or Modification Anomalies: In EMP_DEPT , if we change the value of one


of the attribute of a particular dept, say manager of dept 4. We must update the tuples of
all employees who work in that dept. otherwise, database will become inconsistent.
- If we fail to update some tuple, the same dept will be shown.

iv) Minimising the Null Values in Tuples:- While designing the relation schema, if we
are not sure about certain attribute values or the chosen attribute is not distinct from
others then many tuples while insertion operations, may have to assume NULL values
only.
- This would lead to the problems of wastage of storage space, little or no understanding
of the tuples (what they would actually mean 7) etc...

27
Written By: Mahesh, Nitin, Sunil.
Database Management System

Design Guideline # 3 :
@ Design the relation schema such that all of its attributes assume distinct values other
than NULL values.
@ If at all NULL values are to be used for a particular attribute, it must be in exceptional
cases only and for only a few tuples.

4) Avoiding the Generation of Spurious (fake) tuples:- If we donot combine distinct


attributes (improper grouping), atleast one or two of them from such combination do not
represent either primary key or foreign key then the resulting relation from such
inappropriate grouping of attributes give rise to a large number of fake tuples.
- Such tuples represent either discrete information or most of the time wrong information.
- So that the end user cannot make useful conclusions by employing queries (SELECT
statements) on such relations.
- For instance an improper grouping of attributes from EMPLOYEE and DEPART-
MENT relations as LOCATE-EMPLOYEES.

NAME DOB DEPT-NAME SALARY ADDRESS DEPT-LOCATION

- Can generate a number of invalid tuples or fake tuples which inturn may result into
wrong information for the user/s when he or she queries such tables or relations.
- For example ADDRESS and DEPT-LOCATION may lead to confusing at, but values
as employee address and location of project or department located at the employee
located at etc.,

2) What is Functional Dependency? [2014, 2015, 2016]


Ans:- A functional dependency is a constraint between two sets of attributes from the
database. Suppose that our relational database schema has n attributes A1,A2,... , An; let
us think of the whole database as being described by a single universal relation schema R
= {A1, A2,..., An}.
Definition:- A functional dependency, denoted by X-Y, between two sets of attributes X
and Y that are subsets of R specifies a constraint on the possible tuples that can form a
relation state r of R.
- The constraint is that, for any two tuples t1 and t2 in r that have t1 [X] = t2[X].
- A functional dependency is a property of semantic of attribute.

3) What is Normalization? Explain 1NF, 2NF and 3NF. [2012, 2014, 2015, 2016]
Ans:- Normalisation of data can be considered a process of analysing the given test
schemas based on their FDs and primary keys to achieving the desirable properties
(1) minimising redundancy and (2) minimising the insertion, deletion, and update
anomalies.
- Thus, the normalization procedure provides database designers with the following:

28
Written By: Mahesh, Nitin, Sunil.
Database Management System

i) A formal framework for analyzing relation schemas based on their keys and on the
functional dependencies among their attributes.
ii) A series of normal form tests that can be carried out on individual relation schemas so
that the relational database can be normalized to any desired degree

Definition:- The normal form of a relation refers to the highest normal form condition
that it meets, and hence indicates the degree to which it has been normalised.

NORMAL FORMS:
i) First Normal Form (1NF):- A relation R is said to be in First Normal Form (INF) if
the domain of attributes for each and every tuple contains atomic values and every such
attribute assume a single value only.
- Thus the attributes values that can be recorded for tuples of relations in First Normal
Form (1NF) are atomic, single-valued.
- Accordingly, the first normal form suggests that a relation have tuples with a primary
key and attribute values are indivisible further.

- Consider an example relation: EMPLOYEE-DEPT.


'
EMP-NO E-NAME SALARY DEPT-NUM DEPT-LOCATION
4060 RAGHU 5000 121 {HUBLI,HAMPI}
1130 SRIHARI 8000 142 HASSAN
2075 ASIF. 4500 131 MYSORE
4162 BANU 6000 133 GULBARGA

- A department can have multiple locations or branches. Therefore the relation is not in
1NF. Since DEPT_LOCATION attribute value is multivalued.
- Thus move the repeating group of values by creating another table/relation such as
EMP-LOCATION and original as EMPLOYEE.
- Even we can remove F-NAME attribute column and DEPT_NUM- attribute field from
EMP_LOCATION relation.

ii) Second Normal Form (2NF):- A relation R is said to be Second Normal Form(2NF) if
and only if it is in 1NF & every non-key attribute is fully (functionally) dependent on
primary key.
- In otherwords, for a table or relation to be in Second Normal form, every non-key field
(attribute) must depend on the entire primary key, not on part of a composite primary
key.
- Therefore, if the database consists of relations or tables that have only single-field
(attribute) primary keys.

29
Written By: Mahesh, Nitin, Sunil.
Database Management System

- For instance, in the following table EMPLOYEE-DEPT, the primary key is a composite
key on EMP-ID and DEPT-NUM. However, value of the DEPT-NAME depends only on
DEPT_NUM boy not entire.

Primary Key
EMP_id DEPT_NUM DEPT_NAME
4030 212 DRDO
2017 101 ISRO
6020 212 DRDO
1140 177 HAL
EMPLOYEE_DEPT: A table that violates 2NF

- To normalize this relation, perform grouping of DEPT-NUM and DEPT-NAME into a


separate table. Now every non-key field is fully dependent on the primary key field in each
of the table.

EMP_id DEPT_NUM
4030 212
2017 101
6020 212
1140 177

DEPT_NUM DEPT_NAME
212 DRDO
101 ISRO
212 DRDO
177 HAL

iii) Third Normal Form (3NF):- A relation R is said to be Third Normal Form (3NF), if
and only if it is 2NF & non-key field (attribute) should not be determined by another non-
key field.
OR

- A relation R is said to be Third Normal Form (3NF), if there exist a Non-trivial function
dependency (FD)XA holds in R, either X is super key of R or A is prime attribute of R.

- In other worlds, a non-key field cannot depend on another non-key field in a given
relation R.
- 3NF is based on eliminating ‗Transitive Dependency‘

30
Written By: Mahesh, Nitin, Sunil.
Database Management System

3) Explain Boyce-Codd Normal Form (BCNF). [2015]


Ans:- BCNF can be defined as:
"A relation R is said to be in Boyce- Codd Normal Form (BCNF) if and only if every
determinant (i.e. left-hand side of functional dependency notation) is candidate key‖
- For instance, consider an example of a relation: STUDENT.
The structure of relation scheme for STUDENT appears as follows:

STUDENT:
REG-NO NAME CLASS TELEPHONE

- The TELEPHONE number is as good as CONTACT-ID that distinguish each and every
student. No we assume that REG-NO, NAME and TELEPHONE attributes are distinct
(unique).
- Now the following functional dependencies can be drawn for the STUDENT relation:
fd1: REG-NO NAME
fd2: REG-NO CLASS
fd3: REG-NOTELEPHONE
fd4: NAMECLASS
fd5: NAMETELEPHONE
fd6: TELEPHONE  REG-NO

- Now the STUDENT relation is said to be in BCNF, since all fd‘s contain a candidate key as
the determinant(left hand side).

31
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter – 6
Relational Data Model Concepts and Relation Algebra

1) What is Relation? Explain the characteristics of Relation. [2012, 2014]


Ans:- Relation can be defined to subset of Cartesian Product of a list of domains.
- Accordingly, r(R) denote a mathematical relation of degree n on the domain dom(A1),
dom, (A2)…. Dom (An) and is denoted as:

r(R) C (dom(A1) x dom(A2) x dom(A3) x……… x dom(An))

- Where R denote relation schema.


- It is observed that Cartesian product define all possible combination of value for
specified domains.

Characteristics of Relation:
i) Tuple in a given relation need not to be ordered (where as rows of a given table appears
in same order)
ii) Attribute value in given tuple must be atomic; therefore multivalue attribute must be
represented as separate relations.
iii) Similarly composite attributes are represented by respective composite attributes
iv) Null- a special value is used to denote unknown/undefined values of certain attributes
within a given tuple.

2) Explain Relational Model Constraints. [2015, 2016]


Ans:- Constraints are the Restrictions or integrity rules to be applied on the actual data
values of domains or tuples of data base state or relation state.
- Such constraints are derived from the meaning of data and of real word situation that its
represents.

3 catagories:
i) Inherent Data Model-based Constraints:- For instance a relation with restriction that
it cannot have same or duplicate tuples, represent a constraint that is inherent in data
model.

ii) Schema - based Constraints:- For instance constraints can be directly specified in the
schema of data model. Via:DDL.

iii) Application -based Constraints: For instance constraints cannot be enforced directly
in the schema of data model.
- They must be associated & enforced well within application program that implement
given database.

32
Written By: Mahesh, Nitin, Sunil.
Database Management System

3) What are the different Relational Model Constraints?


Ans:- a) Domain Constraints
b) Key Constraints
c) Constraints on null values.
d) Entity integrity Constraint
e) Referential integrity Constraints

3) Explain Key Constraints (key, Candidate key, super key, foreign key). [2014, 2015]
Ans:- An elegant approach to locate distinct tuples that are unique in a relation is to employe
keys.
i) Key: A key is that property of an attribute in given relation, from which one cannot remove
any attribute till such time the uniqueness property or constraint is maintained.
For ex:- REG_NO in STUDENT relation
EMPLOYEE_ID in a EMPLOYEE relation

ii) Candidate Key:- In given relation, there can be more than one attribute that can identify
each tuple uniquely.
- These attributes form candidate keys.
For ex: employee‘s PPF account no serve as candidate key in addition to original or base key.

iii) Primary Key:- A designated key among candidate key is termed Primary key.
For ex:- REG_NO, Emp_Id etc..

iv) Super Key:- A super key is defend as super set of candidate keys. Super key has the
uniqueness and it can also contain redundant attributes.
- For instance, in given relation there can be subsets of attributes with property or key
constraint that two tuples can have same set of values.

v) Foreign Key:- A foreign key is a set of attributes say in relation schema R1 that finds
match as primary key attributes PK of relation schema R2.
- In otherwords, attributes in foreign key of R1 , expects or observes same domain values as
the attributes in primary key in R2.
- Also, foreign key value in some tuple t1 of relation R2 either finds value of primary key in
other tuple t2.

4) Explain : i) Entity Integrity Constraints [2015]


ii) Referential Integrity Constraints [2015]

Ans:- i) Entity Integrity Constraints:- It suggest that the participating key value of base
Relation should not be Null value. Because it is primary key value that uniquely identifies or
locate individual tuple distinctly.
- Therefore it should not be Null.

33
Written By: Mahesh, Nitin, Sunil.
Database Management System

ii) Referential Integrity Constraints: It suggest that foreign key value in refereeing relation
R1 must find a matching primary key value in some tuple of the referenced relation R2
- To conclude, key constraint & entity integrity constraints are defined on individual relation.
- Where as referential integrity constraints are defined between two relations say R1 & R2.

Relational Algebra

1) What is Relational Algebra? [2015]


Ans:- It is procedural query language consisting of basic set of operations for manipulating the
relational data model. Accordingly Relational Algebraic operations operate on one or more
relations as input & return new relation as output.

2) Explain Binary Relational Operations.


Ans:- i) JOIN :- This operations of relation R1 and R2 denotes by R1<>R2 gives rise to new
relation say Q comprising related tuples of interest that satisfy a given join condition from two
relations R1 and R2 into single tuples.
- Thus JOIN operation enables processing of more than relation at a time.
- In general, JOIN operation is used to combine usefull data from multiple relations.
- Two relations R1(A1,A2,A3…..Am) and R2(B1,B2,B3…. Bn) can be written as :

R1<><join cond>R2
ii) Equi Join:- ―If the comparison operator in join condition s equality(=) then such join
operation is termed as Equi Join‖ (i.e Ɵ is =).

iii) Natural Join(*) :- ― The natural join operation is essential an EQUI JOIN operation with
the removal of redundant attributes holding same values.‖
R1* <join condition> R2 or R1 * R2

iv) Theta Join (Ɵ):- ―A join operation with general join condition as <condition> AND
<condition> AND <condition> ….. Where in each <condition> is of the form Ai Ɵ Bi and Ɵ
happens to be one of the comparison operators.

3) Explain Relational Algebra Set Theory Operations


Ans:- a) Union (U): The union of R1 and R2 denoted as (R1 U R2) is a relation comprising
all tuples of R1 and R2 excluding duplicate or redundant tuples.

b) Intersection: The intersection of R1 and R2 denoted as (R1 Ω R2) is relation comprising


common tuples that are found both R1 and R2.

c) Set Deference (-) : The set difference of R1 and R2 denoted as (R1-R2) is relation
comprising all tuples of R1 but not present in R2.

34
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter – 7
Relational Database Languages (SQL)

1) What is SQL? Explain Create and Alter table operations.


Ans:- SQL uses the terms tables, row and coloum for the formal relational model terms
relation tuple & attributes respectively.
- SQL is Non-procedural language.

i) General Syntax of Creating Table:


CREATE TABLE table_name
(column_name datatype(size) [constraint],
column_name datatype(size) [constraint],
! ! !
! ! !
column_name datatype(size) [constraint]);

ii) General Syntax of Altering Table:


a) ALTER TABLE<table_name> ADD <new coloumn datatype>;
b) ALTER TABLE<table_name> MODIFY <coloumn name datatype>;

2) Explain Views (virtual tables) in SQL.


Ans:- CREATE VIEW is powerful SQL command that permits us to create a view &
control access to our tables.
- A view can be framed by considering one or more coloumns/ attributes of base table.
- View can be thought of as window into database tables, through which only selected
columns and rows are visible.
- Views can be thought of as stored query.

Advantages of creating View:


i) Views offer additional level of security on base table by restricting access to pre-
determined set of rows and /or columns of that table.
ii) Views hide the data complexity since, views can be created by joining fields of two or
more tables.
Creating View Statement:
CREATE VIEW view_name [[coloum_name [,coloum_name]…]]
AS query _ statement
[WITH CHECK OPTION];
Examples of Create View Statements:
SQL> CREATE VIEW AYURVEDIC
AS SELECT BATCH_NO NAME,DOM
FROM DRUGS
WHERE MEDI_TYPE= ‘ AYURVEDIC‘;

35
Written By: Mahesh, Nitin, Sunil.
Database Management System

Chapter - 9
Transaction Processing Concepts Concurrency Control Technique

1) What Transaction? Explain desirable properties of transaction.


Ans:- A transaction is a single execution of a program forms a logical unit of database
processing.
- It may have sequence of database access/ update operation such as; insertion, delete, modify,
select etc…
- One way to specifying the transaction is by specifying explicit begin transaction & end
transaction in application program.

Desirable Properties of Transaction: Acid properties:


1) Atomicity:- Either the complete set of operations of given transaction are applied or no
single operation is performed at all. This all or none nature is referred to as Atomicity.
- This property ensures that a given transaction must be executed to its completion.

2) Consistency:- A transaction must be executed in isolated such that no other transaction is


executing concurrently.
- This behaviors preserve the consistency of the database.

3) Isolation:- A given transaction must be unaware of other transaction being executed


concurrently in the system.
- This property ensures that given transaction execution should not be interfered with any other
transaction that being executed concurrently in the system.

4) Durability:- The changes if any, made to the database by a committed transaction must
continue to exist permanently, even in case of system failures.
- It‘s the responsibility of the recovery mechanism of DBMS to ensure the durability of the
database, which is currently subjected to number of transaction executions.

Concurrency Control Techniques

1) What Concurrency Control Techniques?


Ans: - When a number of transactions execute concurrently in the DBMS environment, the
consistency of data is no longer be preserved. So it is necessary for the system to control the
interaction among the concurrent transaction.
- Such control is called as ‗Concurrency Control Techniques‘.

36
Written By: Mahesh, Nitin, Sunil.
Database Management System

2) Explain Two-Phase Locking system for Concurrency Control.


Ans:- Locking system offer mechanism to control simulations access to data. Whenever a
particular transaction is accessing some item of the given database, a lock or locking technique
shall deny access subsequent transaction.
- It would attempt same items of the database in order to prevent interference of two or more
operations at same time would yield wrong output.
- A lock is restriction on accessing items of database in multiuser DB environment such a
census data.
- Thus lock prevents multiple users from modifying the same items of database
simultaneously.

3) Explain Types of Locks.


Ans:- 1) Binary Locks
2) Shared Locks (Read -Locks)
3) Exclusive Locks (Write- Locks)

1) Binary Locks:- As the name itself indicates it has two states i.e. Locked(1) and
Unlocked(0).
- The operations associated with Binary Locking system are
i) Lock – item(x)
ii) Unlock – item(x)
- Whenever, transaction would like to access a database item X, it first issues an operation
execution: lock-item (x).
- However, if items X is free to use i.e. unlocked i.e. LOCK (X) = 0

2) Shared Locks (read locks):- This locks are used for ―read-only‖ purposes. It is also called
shared locks, since more than one transaction can read an item of the data at same time.

3) Exclusive Locks (write- locks):- Used for Possible modification/ update operation on item
of the database including reading.
- They are used exclusively for single transaction to hold the lock on the item to be written/
updated.

37
Written By: Mahesh, Nitin, Sunil.
Database Management System

6076 - E23 -VS BCA (R) N 12


FIFTH SEMESTER B.C.A. DEGREE EXAMINATION, NOVEMBER 2012
DATABASE MANAGEMENT SYSTEM
Paper: BCA - 503
Time : 3 Hours
Max. Marks: 80
Answer any five full questions.

1. (a) What is database? Explain the characteristics of the database approach. (10+6=16)
(b) Discuss the actors on the scene.

2. (a) What is a data model? Discuss the different categories of data models. (8+8=16)
(b) Discuss in detail the DBMs languages.

3. (a) Define the following : (6+10=16)


i) Entity
ii) attribute
iii) Value
Give examples for each.
(b) What is ER-diagram? Write the notations and their meaning used in ER-diagrams.

4. (a) What is a file? Explain the operations performed on a file. (8+2+6=16)


(b) What is buffering of blocks?
(c) Explain the fixed length and variable length records.

5. (a) Discuss the, Informal design guidelines for relational schemas. (8+8=16)
(b) What is normalization? Discuss first normal form, second normal form and third
normal form

6. (a) What is a relation? Discuss the characteristics of relations. (8+8=16)


(b) Explain the basic relational algebra operations.

7. (a) Explain with their syntax different DML communion SQL. (8+8=16)
(b) What is a procedure? Discuss the syntax for creating a procedure in PL/SQL.

8. (a) Explain the desirable properties of transaction. (8+8=16)


(b) Why locks are used? Discuss the different types of locks.

38
Written By: Mahesh, Nitin, Sunil.
Database Management System

7086 - E23 VS BCA - N 14


FIFTH SEMESTER B.C.A. DEGREE EXAMIITION, NOVEMBER 2014
DATABASE MANAGEMENT SYSTEM
Time : 3 Hours]
[Max. Marks : 80
Answer any five full questions.
Draw neatly wherever necessary.

I. a) What is DBMS? Explain the characteristics of database approach. (8 + 8=16)


b) Who are the Actors on scene? Explain in detail the roles of each actors in DBMS.

II. a) Define the terms: (3+8+5=16)


i) Data model
ii) Database schema
iii) Database state.
b) Explain, three schema architecture in details.
c) Explain "When not to use a DBMS".

III. a) Define attribute. Explain different types of attributes with example. (8+4+4=16)
b) Define the terms
i) Entity
ii) Relationship type with example
c) Cardinality ratio and participation constraints with example.

IV. a) Discuss different operations on files. (8+8=16)


b) Explain the concept of Heap files.

V. a) Define functional dependency. Explain INF and 2NF with example. (8+8=16)
b) Explain:
i) Insertion Anomalies
ii) Deletion Anomalies Modification Anomalies.

VI. a) Define relation. Explain characteristics of relations. (8+4+4=16)


b) Explain:
i) Entity integrity constraint
ii) Referential integrity constraint.

c) Define
i) Key
ii) Candidate key with example.

39
Written By: Mahesh, Nitin, Sunil.
Database Management System

VII. a) What is transaction? Explain the properties of transaction. (8+8=16)


b) List and explain data definition language commands with example.

VIII. Write short notes on (any 4): (4+4+4+4=16)


a) Users of DBMS
b) Concept of views in SQL
c) Weak entity type Select and project operation
d) Concurrency control
e) Hashing techniques.

40
Written By: Mahesh, Nitin, Sunil.
Database Management System

5076-E23-VSBCA-N-15
B.C.A. DEGREE EXAMINATION NIOVEMBER 2015.
Fifth Semester
DATABASE MANAGEMENT SYSTEM
THEORY
Time: Three hours
Maximum: 80 marks

Answer any FIVE full questions.


Draw neatly wherever necessary.

1. (a) Define Database Management System. Explain the characteristics of Database.


(b) Who are the actors on scene? Explain in detail the role of each actors in DBMS.
(8+8=16)

2. (a) Describe the three schema architecture. Why do we need mapping between schema
levels?
(b) Define the following:
i) DDL
ii) SDL
iii) VDL
iv) DML
(8 + 8 = 16)

3. a) What 'is an entity type? What is an entity set? Explain the differences among an
entity, an entity type and an entity set.
b) Differentiate
(i) Composite Versus Simple, attribute
(ii) Single valued versus multi valued attributes
(iii) Stored valued versus derived attributes
(c) Define the following:
(i) Weak Entity
(ii) Primary key
(8+6+2=16)
4. (a) Explain the different operations on file.
(b) Explain the concept of buffering of blocks.
(c) What is RAID? Explain briefly. (8+4+4=16)

41
Written By: Mahesh, Nitin, Sunil.
Database Management System

5. (a) What is Functional dependency? (2+6+6+2=16)


(b) What is Normalization? Explain I NF, 2NF, and 3NF etc.
(c) Explain au two secondary storage devices.
(d) Explain Boyce Normal Form.

6. (a) Define the following: (6 +6+4=16)


(i) Key
(ii) Foreign Key
(iii) Super Key
(iv) Candidate Key
(b) What is Relational Model? Explain the characteristics of Relations.
(c) Define the following:
(i) Entity Integrity Constraint
(ii) Referential Integrity Constraints
(iii) Equijoin
(iv) Natural join

7. (a) What is Cursor? Explain the concept of cursor with example. (6+8+2=16)
(b) Explain the following definition with example:
(i) CREATE
(ii) ALTER
(iii) DROP
(iv) UPDATE
(c) What is Transaction Processing?

8. Write short notes on any FOUR of the following: (4+4+4+4)


(a) Data Independence
(b) Data Abstraction
(c) Concept of views in SQL
(d) Hashing techniques
(e) Relational Algebra
(f) PL/SQL Packages

42
Written By: Mahesh, Nitin, Sunil.
Database Management System

6055 - E23 - VS BCA - N 16


FIFTH SEMESTER B.C.A. DEGREE EXAMINATION, NOVEMBER 2016
DATABASE MANAGEMENT SYSTEM
(Theory)
Time : 3 Hours
Max. Marks: 80
Answer any five full questions.
Draw the neat diagram wherever necessary.

1. a) Define DBMS, explain characteristics of Database.


b) Describe 3 schema architecture. Why do we need mapping between schema levels?
(8+8=16)
2. a) What are responsibilities of DBA and database designer?
b) Discuss different type of database interfaces.
(8+8=16)
3. a) What is data model? Explain categories of data models.
b) Explain three schema Architecture.
c) Define database Schema.
(6+8+2=16)
4. a) Define following:
i) DDL
ii) SDL
iii) VDL
iv) DML
b) Define E-R diagram. Explain E-R notations.
(8+8=16)

5. a) Explain any two secondary storage devices.


b) What is hashing? Explain type of hashing techniques.
(8+8=16)

6. a) What is Normalization? When can you say that relation is in normal form?
Explain INF, 2NF, 3NFI.
b) Explain following commands:
i) Alter
ii) Update
iii) Insert
(8+8=16)

7. a) Explain views with example.


b) Explain procedures and packages in PL/SQL.
(8+8=16)

43
Written By: Mahesh, Nitin, Sunil.
Database Management System

8. Write short note on any four of the following:


a) Functional dependency
b) Data models, schemas and instances
c) Concurrency control
d) Relational data model
e) PL/SQL
f) Classification of DBMS.
(4 x 4 = 16)

44
Written By: Mahesh, Nitin, Sunil.

You might also like