0% found this document useful (0 votes)
71 views

DBMS CAT 3 Assignments

The document contains an assignment on Database Management Systems (DBMS) with 8 questions. It provides the details of a student named Mohit Singh Bisht from the Computer Science department in the third semester of their second year. The questions cover objectives of DBMS, differences between file systems and DBMS, examples of DBMS, architectures of DBMS including one-tier, two-tier and three-tier, and concepts such as DDL, DML, DCL and SQL queries.

Uploaded by

Pawan Negi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views

DBMS CAT 3 Assignments

The document contains an assignment on Database Management Systems (DBMS) with 8 questions. It provides the details of a student named Mohit Singh Bisht from the Computer Science department in the third semester of their second year. The questions cover objectives of DBMS, differences between file systems and DBMS, examples of DBMS, architectures of DBMS including one-tier, two-tier and three-tier, and concepts such as DDL, DML, DCL and SQL queries.

Uploaded by

Pawan Negi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 37

B. Tech.

CSE Second Year


Semester 3 Fall-2022-23
Subject: DBMS

ASSIGNMENT OF UNIT 1

Sec. Admission No. Name of Student

5 21SCSE1010810 Mohit Singh Bisht

Subject Teacher:
Mrs Parvesh
QUESTION 1

What is the objective to study DBMS?

DBMS is a collection of programs that enable users to create and maintain a database. The DBMS

is hence a General purpose software system that facilitates the processes of defining, constructing

and manipulating databases for various applications.

Database management system (DBMS) consists of a collection of interrelated data and a set of

programs to access that data. The collection data is usually referred to as data base which contains

information about one particular enterprise.

The primary goal of a DBMS is to provide an environment that is both convenient and efficient to

use in retrieving and storing data base information. The DBMS is the interface between the user of

application programs on one hand and the data base on the other.

The objective of a database management system is to facilitate the creation of data structures and

relieve the programmer of the problems of setting up complicated files. Data base management

systems have developed from a concept of the data base as something distinct from the programs

accessing it.

QUESTION 2

The difference between file system and database system.

FILE SYSTEM DBMS

Used to manage and organise the files stored in A software to store and retrieve the user’s data
the hard disk of the computer

Redundant data is present No presence of redundant data

Query processing is not so efficient Query processing is efficient

Data consistency is low Due to the process of normalisation, the data


consistency is high

Less complex, does not support complicated More complexity in managing the data, easier to
transactions implement complicated transactions
Less security Supports more security mechanisms

Less expensive in comparison to DBMS Higher cost than the File system

Does not support crash recovery Crash recovery mechanism is highly supported

QUESTION 3

Give examples DBMS?

MySQL Database
MS- Access
MS- Access
Oracle Database
IBM DB2
Microsoft SQL Server
Amazon RDS
File Maker
NoSQL
Postgresq
MS Fox Pro
Ingres
Adabas

QUESTION 4
Three-tier architecture of DBMS.

Tier-3 Architecture
The 3-tier architecture contains one more layer between the client and the server.
 In this architecture, there is no direct communication between client and server.
 Mainly, the 3-tier is used for large applications on the web.
 The features of 3-tier architecture are data backup, recovery, security, and
concurrency control.
Layers
The 3-tier architecture consists of the three layers as follows −
 Presentation layer − This layer is also called the client layer. The front-end layer
consists of a user interface. The main purpose is to communicate with the application
layer.
 Application layer − This layer is also called the business logic layer. It acts as a
middle layer between the client and the database server which are used to exchange
partially processed data.
 Database layer − In this layer the data or information is stored. This layer performs
operations like insert, update and delete to connect with the database.
QUESTION 5.

Two-tier architecture of DBMS

The 2-tier Architecture is based on a client-server machine.


In this type of architecture, the applications on client-side interact directly with the database
present at the server-side.
This interaction between client and server uses Application Program Interface like ODBC and
JDBC.
 ODBC − Open Database Connectivity
 JDBC − Java Database Connectivity
When there are a large number of users at client side to access the database, this architecture gives
a poor performance.
The server side is responsible for delivering the functionalities like query processing and
management of transactions.
For example − Oracle, Sybase, Microsoft SQL Server etc.

QUESTION 6

One-tier architecture of DBMS

In 1-tier architecture, the data is directly provided to the user and that user can directly use the
database through the computer.
 Any changes or updates that are done will reflect directly to the database.
 The 1-tier architecture is used for the development of applications where a
programmer directly communicates with the database for very fast response.
 It is used for enhancement of the local application.

QUESTION 7

Write are the Full form of DDL, DML and DCL?

DDL – Data definition language


DML – Data manipulation language

DCL - Data control language

QUESTION 8
 Explain DDL, DML, DCL and TCL.

. Data Definition Language (DDL)


o DDL changes the structure of the table like creating a table, deleting a table, altering a table,
etc.
o All the command of DDL are auto-committed that means it permanently save all the
changes in the database.

Here are some commands that come under DDL:

o CREATE
o ALTER
o DROP
o TRUNCATE

. Data Manipulation Language


o DML commands are used to modify the database. It is responsible for all form of changes in
the database.
o The command of DML is not auto-committed that means it can't permanently save all the
changes in the database. They can be rollback.

Here are some commands that come under DML:

o INSERT
o UPDATE
o DELETE

Data Control Language


DCL commands are used to grant and take back authority from any database user.

Here are some commands that come under DCL:

o Grant
o Revoke

Transaction Control Language

TCL commands can only use with DML commands like INSERT, DELETE and UPDATE only.

These operations are automatically committed in the database that's why they cannot be used while
creating tables or dropping them.

Here are some commands that come under TCL:

o COMMIT
o ROLLBACK
o SAVEPOINT

Data Query Language

DQL is used to fetch the data from the database.

It uses only one command:

o SELECT
B. Tech. CSE Second Year
Semester 3 Fall-2022-23
Subject: DBMS

ASSIGNMENT OF UNIT 2

Sec. Admission No. Name of Student

5 21SCSE1010810 Mohit Singh Bisht

Subject Teacher:
Mrs Parvesh
QUESTION 1

Write SQL query to get the Student name whose salary is between 1000 and 2000.

SELECT *
FROM employees
WHERE salary BETWEEN (SELECT 1000) AND 2000;

QUESTION 2

Write SQL query to get the Students Name and address from Student table .

SELECT name, address FROM `student`

QUESTION 3

Write SQL query to get the Students Name who have got marks greater than 90 from Student
table

select student_name
from student join mark using (student_id)
group by student_name
having min(value) > 90
order by student_name;
QUESTION 4

Explain Union and Intersection in DBMS.

Union
Union combines two different results obtained by a query into a single result in the form of a table.
However, the results should be similar if union is to be applied on them. Union removes all
duplicates, if any from the data and only displays distinct values. If duplicate values are required in
the resultant data, then UNION ALL is used.
An example of union is −

Select Student_Name from Art_Students


UNION
Select Student_Name from Dance_Students
This will display the names of all the students in the table Art_Students and Dance_Students i.e
John, Mary, Damon and Matt.
Intersection
The intersection operator gives the common data values between the two data sets that are
intersected. The two data sets that are intersected should be similar for the intersection operator to
work. Intersection also removes all duplicates before displaying the result.
An example of intersection is −

Select Student_Name from Art_Students


INTERSECT
Select Student_Name from Dance_Students
This will display the names of the students in the table Art_Students and in the table
Dance_Students i.e all the students that have taken both art and dance classes .Those are Mary and
Damon in this example.

QUESTION 5

Explain join in DBMS.

In DBMS, a join statement is mainly used to combine two tables based on a specified
common field between them. If we talk in terms of Relational algebra, it is the cartesian product
of two tables followed by the selection operation. Thus, we can execute the product and selection
process on two tables using a single join statement. We can use either 'on' or 'using' clause in
MySQL to apply predicates to the join queries.

A Join can be broadly divided into two types:

1. Inner Join

Inner Join is a join that can be used to return all the values that have matching
values in both the tables. 

2. Outer Join

Outer Join is a join that can be used to return the records in both the tables whether
it has matching records in both the tables or not.
QUESTION 6

Explain Cartesian Product in DBMS with example.


A Cartesian product is the result of joining every row in one table with every row in another table.
This occurs when there is no WHERE clause to restrict rows. While this is legitimate in some
cases, most occurrences of a Cartesian product are mistakes. The Cartesian product is somewhat
analogous to a correlated subquery—that is, it performs a full table scan on the second table for
every row in the first table.  Cartesian product operation
It combines R1 and R2 without any condition. It is denoted by X.
Degree of R1 XR2 = degree of R1 + degree of R2
{degree = total no of columns}
Example
Consider R1 table −

RegNo Branch Section

1 CSE A

2 ECE B

3 CIVIL A

4 IT B
Table R2
Name RegNo

Bhanu 2

Priya 4
R1 X R2
RegNo Branch Section Name RegNo

1 CSE A Bhanu 2

1 CSE A Priya 4

2 ECE B Bhanu 2

2 ECE B Priya 4

3 CIVIL A Bhanu 2

3 CIVIL A Priya 4

4 IT B Bhanu 2
RegNo Branch Section Name RegNo

4 IT B Priya 4

QUESTION 7

Explain Select and Project.

Select Operation : This operation is used to select rows from a table (relation) that specifies
a given logic, which is called as a predicate. The predicate is a user defined condition to
select rows of user's choice.

Project Operation : If the user is interested in selecting the values of a few attributes,
rather than selection all attributes of the Table (Relation), then one should go
for PROJECT Operation.

Select operations : Select operation displays the records for the condition. Select operation is
denoted by sigma (σ).
Syntax: 
σcondition(TableName)
Example:

RollNo Name Brach


012 Jayesh CSE
013 Kunal ME
015 Dipali EC
Input:
σName=Jayesh(Student)
Output:

RollNo Name Brach


012 Jayesh CSE
Project operation : Project operations displays the specific column of a table. Projection operation
is denoted by pie (∏).
Syntax: 
∏ColumnName (TableName)
Example:

RollNo Name Brach


012 Jayesh CSE
013 Kunal ME
015 Dipali EC
Input:
∏RollNo (Student)
Output:

RollNo
012
013
015

B. Tech. CSE Second Year


Semester 3 Fall-2022-23
Subject: DBMS

ASSIGNMENT OF UNIT 3

Sec. Admission No. Name of Student


5 21SCSE1010810 Mohit Singh Bisht

Subject Teacher:
Mrs Parvesh
Question 1.
What is partial functional dependency?

A functional dependency A → B is said to be partial if removal of any subset of A still able to
recognize B uniquely.  

Partial Dependency is a form of Functional dependency that holds on a set of attributes. It is about
the complete dependency of a right hand side attribute on one of the left hand side attributes.

For example, in a functional dependency PQ → R, if either P alone or Q alone can uniquely
identify R, then this is said to be Partial Functional Dependency. We read this as R is partially
functionally dependent on P or R is partially functionally dependent on Q.

Question 2.
What is transitive functional dependency?

A functional dependency is said to be transitive if it is indirectly formed by two functional


dependencies. For e.g.

X -> Z is a transitive dependency if the following three functional dependencies hold true:

 X->Y
 Y does not ->X
 Y->Z

Note: A transitive dependency can only occur in a relation of three of more attributes. This
dependency helps us normalizing the database in 3NF (3rd Normal Form).

Question 3.
What is full functional dependency?

Full functional dependency is defined as all the non candidate key attributes fully depends upon
primary key attribute.

For Example,

Employee(id,name,location)

In this, name and location is fully depends upon id. (name,location->id)

Where,

name and location -> non primary key attributes ; id -> primary key attribute.

Importance of Full functional dependency :

 to maintain consistency
 to avoid insertion anomaly problem
QUESTION 4.
Explain 1NF, 2NF, 3NF, BCNF, 4NF with Example

First Normal Form (1NF)


o A relation will be 1NF if it contains an atomic value.
o It states that an attribute of a table cannot hold multiple values. It must hold only single-
valued attribute.
o First normal form disallows the multi-valued attribute, composite attribute, and their
combinations.

Example: Relation EMPLOYEE is not in 1NF because of multi-valued attribute EMP_PHONE.

EMPLOYEE table:

EMP_ID EMP_NAME EMP_PHONE EMP_STATE

14 John 7272826385, UP
9064738238

20 Harry 8574783832 Bihar

12 Sam 7390372389, Punjab


8589830302

The decomposition of the EMPLOYEE table into 1NF has been shown below:

EMP_ID EMP_NAME EMP_PHONE EMP_STATE

14 John 7272826385 UP

14 John 9064738238 UP

20 Harry 8574783832 Bihar

12 Sam 7390372389 Punjab

12 Sam 8589830302 Punjab

Second Normal Form (2NF)


o In the 2NF, relational must be in 1NF.
o In the second normal form, all non-key attributes are fully functional dependent on the
primary key
Example: Let's assume, a school can store the data of teachers and the subjects they teach. In a
school, a teacher can teach more than one subject.

TEACHER table

TEACHER_ID SUBJECT TEACHER_AGE

25 Chemistry 30

25 Biology 30

47 English 35

83 Math 38

83 Computer 38

In the given table, non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a


proper subset of a candidate key. That's why it violates the rule for 2NF.

To convert the given table into 2NF, we decompose it into two tables:

TEACHER_DETAIL table:

TEACHER_ID TEACHER_AGE

25 30

47 35

83 38

TEACHER_SUBJECT table:

TEACHER_ID SUBJECT

25 Chemistry

25 Biology

47 English

83 Math

83 Computer
Third Normal Form (3NF)
o A relation will be in 3NF if it is in 2NF and not contain any transitive partial dependency.
o 3NF is used to reduce the data duplication. It is also used to achieve the data integrity.
o If there is no transitive dependency for non-prime attributes, then the relation must be in
third normal form.

A relation is in third normal form if it holds atleast one of the following conditions for every non-
trivial function dependency X → Y.

1. X is a super key.
2. Y is a prime attribute, i.e., each element of Y is part of some candidate key.

Example:

EMPLOYEE_DETAIL table:

EMP_ID EMP_NAME EMP_ZIP EMP_STATE EMP_CITY

222 Harry 201010 UP Noida

333 Stephan 02228 US Boston

444 Lan 60007 US Chicago

555 Katharine 06389 UK Norwich

666 John 462007 MP Bhopal

Super key in the table above:

1. {EMP_ID}, {EMP_ID, EMP_NAME}, {EMP_ID, EMP_NAME, EMP_ZIP}....so on  

Candidate key: {EMP_ID}

Non-prime attributes: In the given table, all attributes except EMP_ID are non-
prime.
Here, EMP_STATE & EMP_CITY dependent on EMP_ZIP and EMP_ZIP dependent on
EMP_ID. The non-prime attributes (EMP_STATE, EMP_CITY) transitively dependent
on super key(EMP_ID). It violates the rule of third normal form.

That's why we need to move the EMP_CITY and EMP_STATE to the new
<EMPLOYEE_ZIP> table, with EMP_ZIP as a Primary key.

EMPLOYEE table:

EMP_ID EMP_NAME EMP_ZIP

222 Harry 201010

333 Stephan 02228

444 Lan 60007

555 Katharine 06389

666 John 462007

EMP_ZIP EMP_STATE EMP_CITY

201010 UP Noida

02228 US Boston

60007 US Chicago

06389 UK Norwich

462007 MP Bhopal

EMPLOYEE_ZIP table:

Boyce Codd normal form (BCNF)


o BCNF is the advance version of 3NF. It is stricter than 3NF.
o A table is in BCNF if every functional dependency X → Y, X is the super key of the
table.
o For BCNF, the table should be in 3NF, and for every FD, LHS is super key.

Example: Let's assume there is a company where employees work in more than one department.
EMPLOYEE table:

EMP_ID EMP_COUNTRY EMP_DEPT DEPT_TYPE EMP_DEPT_NO

264 India Designing D394 283

264 India Testing D394 300

364 UK Stores D283 232

364 UK Developing D283 549

In the above table Functional dependencies are as follows:

1. EMP_ID  →  EMP_COUNTRY  
2. EMP_DEPT  →   {DEPT_TYPE, EMP_DEPT_NO}  

Candidate key: {EMP-ID, EMP-DEPT}

The table is not in BCNF because neither EMP_DEPT nor EMP_ID alone are keys.

To convert the given table into BCNF, we decompose it into three tables:

EMP_COUNTRY table:

EMP_ID EMP_COUNTRY

264 India

264 India

EMP_DEPT table:

EMP_DEPT DEPT_TYPE EMP_DEPT_NO

Designing D394 283

Testing D394 300

Stores D283 232

Developing D283 549

EMP_DEPT_MAPPING table:
EMP_ID EMP_DEPT

D394 283

D394 300

D283 232

D283 549

Functional dependencies:

1. EMP_ID   →    EMP_COUNTRY  
2. EMP_DEPT   →   {DEPT_TYPE, EMP_DEPT_NO}  

Candidate keys:

For the first table: EMP_ID

For the second table: EMP_DEPT


For the third table: {EMP_ID, EMP_DEPT}

QUESTION 5.
What is the difference between 3NF and BCNF.
S.NO. 3NF BCNF

In 3NF there should be no transitive


dependency that is no non prime attribute In BCNF for any relation A-
should be transitively dependent on the >B, A should be a super key of
1. candidate key. relation.

It is comparatively more
2. It is less stronger than BCNF. stronger than 3NF.

In BCNF the functional


In 3NF the functional dependencies are dependencies are already in
3. already in 1NF and 2NF. 1NF, 2NF and 3NF.

The redundancy is
4. The redundancy is high in 3NF. comparatively low in BCNF.

In BCNF there may or may


In 3NF there is preservation of all functional not be preservation of all
5. dependencies. functional dependencies.
S.NO. 3NF BCNF

6. It is comparatively easier to achieve. It is difficult to achieve.

Lossless decomposition can be achieved by Lossless decomposition is


7. 3NF. hard to achieve in BCNF.

Question 6.

R(C, S, Z)

    CS→Z

      Z→C

Find the list of candidate key.

QUESTION 7.

Find Normal Form

Emp(ename, did, empid, salary)

ename, did->salary

did, empid-> salary

ename -> empid

empid->ename

QUESTION 8.

Find the Normal Form

R(A,B,C,D,E)

A->BC

BC->E

E->DA
B. Tech. CSE Second Year
Semester 3 Fall-2022-23
Subject: DBMS

ASSIGNMENT OF UNIT 4

Sec. Admission No. Name of Student

5 21SCSE1010810 Mohit Singh Bisht

Subject Teacher:
Mrs Parvesh
QUESTION 1.
What is concurrent schedule?

A schedule is said to be concurrent in case the instructions of the transactions get executed
preemptively.

When the database system executes several transactions concurrently, the corresponding schedule
no longer needs to be serial.

If two transactions are running concurrently, the operating system may execute one transaction for
a little while, then perform a context switch, execute the second transaction for some time, and then
switch back to the first transaction for some time, and so on. With multiple transactions, the CPU
time is shared among all the transactions.

Several execution sequences are possible, since the various instructions from both
transactions may now be interleaved.

In general, it is not possible to predict exactly how many instructions of a transaction will be
executed before the CPU switches to another transaction.

Thus, the number of possible schedules for a set of n transactions is much larger than n!.

Concurrent schedules might get affected with conflicting operations and hence does not give
guaranty for data consistency.

QUESTION 2.

What is deadlock?

A deadlock is a situation in which two computer programs sharing the same resource are effectively
preventing each other from accessing the resource, resulting in both programs ceasing to function.

The earliest computer operating systems ran only one program at a time. All of the resources of the
system were available to this one program. Later, operating systems ran multiple programs at once,
interleaving them. Programs were required to specify in advance what resources they needed so that
they could avoid conflicts with other programs running at the same time. Eventually some
operating systems offered dynamic allocation of resources. Programs could request further
allocations of resources after they had begun running. This led to the problem of the deadlock. Here
is the simplest example:

Program 1 requests resource A and receives it.


Program 2 requests resource B and receives it.

Program 1 requests resource B and is queued up, pending the


release of B.

Program 2 requests resource A and is queued up, pending the


release of A.

Now neither program can proceed until the other program releases a resource. The operating system
cannot know what action to take. At this point the only alternative is to abort (stop) one of the
programs.

Learning to deal with deadlocks had a major impact on the development of operating systems and
the structure of databases. Data was structured and the order of requests was constrained in order to
avoid creating deadlocks.

QUESTION 3.
What do you mean by serializable schedule.

A non-serial schedule is called a serializable schedule if it can be converted to its equivalent serial
schedule. In simple words, if a non-serial schedule and a serial schedule result in the same then the
non-serial schedule is called a serializable schedule.
Transaction-1 Transaction-2
R(a)
W(a)
R(b)
W(b)
R(b)
R(a)
W(b)
W(a)

QUESTION 4.

What is serial schedule?

1. Serial Schedule - A schedule in which only one transaction is executed at a time, i.e., one
transaction is executed completely before starting another transaction.

Example:

Transaction-1 Transaction-2
R(a)
W(a)
R(b)
Transaction-1 Transaction-2
W(b)
R(b)
W(b)
R(a)
W(a)

QUESTION 5.

What do you mean by ACID property?

A transaction in a database system must maintain Atomicity, Consistency, Isolation, and Durability
− commonly known as ACID property − in order to ensure accuracy, completeness, and data
integrity.

 Atomicity
 Consistency
 Isolation
 Durability
Atomicity: –
 A transaction is an atomic unit of processing.
 It is either performed entirely or not performed at all.
 Means either all operations are reflected in the database or none are.
 It is the responsibility of the transaction recovery subsystem to ensure atomicity.
 moreover, If a transaction fails to complete for some reason, the recovery technique must
undo any effects of the transaction on the database.
Consistency: –
 A transaction is consistency preserving if its complete execution takes the database from
one consistent state to another.
 It is the responsibility of the programmer who writes database programs.
 Database programs should be written in such a way that, if the database is in a consistent
state before execution of transaction. After That it will be in a consistent state after
execution of transaction.
 For instance, Transaction is :- Transfer $50 from account A to account B.
 If account A having amount $100 & account B having amount $ 200 initially then after
execution of transaction, A must have $ 50 & B must have $ 250.
Isolation: –
 If multiple transactions execute concurrently. They should produce the result as if they are
working serially.
 Further, It is enforce a concurrency control subsystem.
 To avoid the problem of concurrent execution, transactions should be executed in isolation.
Durability: –
 The changes applied to the database, by a committed transaction must persist in a database.
 The changes may not be lost because of any failure.
 It is the responsibility of the recovery subsystem of the DBMS.

QUESTION 6.
check the given schedule is serializable or not.
Consider the following schedule for transaction T1, T2, T3

T1 T2 T3
r(x)
r(y)
r(y)
w(y)
w(x)
w(x)
r(x)
w(x)
Testing of Serializability

Serialization Graph is used to test the Serializability of a schedule.

Assume a schedule S. For S, we construct a graph known as precedence graph. This graph has a
pair G = (V, E), where V consists a set of vertices, and E consists a set of edges. The set of vertices
is used to contain all the transactions participating in the schedule. The set of edges is used to
contain all edges Ti ->Tj for which one of the three conditions holds:

1. Create a node Ti → Tj if Ti executes write (Q) before Tj executes read (Q).


2. Create a node Ti → Tj if Ti executes read (Q) before Tj executes write (Q).
3. Create a node Ti → Tj if Ti executes write (Q) before Tj executes write (Q).

Explanation:

Read(A): In T1, no subsequent writes to A, so no new edges


Read(B): In T2, no subsequent writes to B, so no new edges
Read(C): In T3, no subsequent writes to C, so no new edges
Write(B): B is subsequently read by T3, so add edge T2 → T3
Write(C): C is subsequently read by T1, so add edge T3 → T1
Write(A): A is subsequently read by T2, so add edge T1 → T2
Write(A): In T2, no subsequent reads to A, so no new edges
Write(C): In T1, no subsequent reads to C, so no new edges
Write(B): In T3, no subsequent reads to B, so no new edges

A non-serial schedule is called a serializable schedule if it can be converted to its equivalent serial
schedule. In simple words, if a non-serial schedule and a serial schedule result in the same then the
non-serial schedule is called a serializable schedule
Hence the given schedule is serializable

B. Tech. CSE Second Year


Semester 3 Fall-2022-23
Subject: DBMS

ASSIGNMENT OF UNIT 5

Sec. Admission No. Name of Student


5 21SCSE1010810 Mohit Singh Bisht

Subject Teacher:
Mrs Parvesh
QUESTION 1
What is temporary update problem?

The Lost Update problem arises when an update in the data is done over another update but by
two different transactions.

Example: Consider two transactions A and B performing read/write operations on a data DT in


the database DB. The current value of DT is 1000: The following table shows the read/write
operations in A and B transactions.

Time A B
T1 READ(DT) ------
T2 DT=DT+500 ------
T3 WRITE(DT) ------
T4 ------ DT=DT+300
T5 ------ WRITE(DT)
T6 READ(DT) ------

Transaction A initially reads the value of DT as 1000. Transaction A modifies the value of DT from
1000 to 1500 and then again transaction B modifies the value to 1800. Transaction A again reads
DT and finds 1800 in DT and therefore the update done by transaction A has been lost.

The Temporary Update Problem. • Occurs when a transaction fails but updated item is accessed
by another transaction before it is changed back to its original value.

QUESTION 2
Explain Two Phase Locking Protocol

2PL locking protocol


Every transaction will lock and unlock the data item in two different phases.
 Growing Phase − All the locks are issued in this phase. No locks are released, after
all changes to data-items are committed and then the second phase (shrinking phase)
starts.
 Shrinking phase − No locks are issued in this phase, all the changes to data-items
are noted (stored) and then locks are released.
The 2PL locking protocol is represented diagrammatically as follows −
In the growing phase transaction reaches a point where all the locks it may need has been acquired.
This point is called LOCK POINT.
After the lock point has been reached, the transaction enters a shrinking phase.

QUESTION 3
What is the objective to do concurrency control?

Concurrency Control in Database Management System is a procedure of managing simultaneous


operations without conflicting with each other. It ensures that Database transactions are performed
concurrently and accurately to produce correct results without violating data integrity of the
respective Database.

Reasons for using Concurrency control method is DBMS:

 To apply Isolation through mutual exclusion between conflicting transactions


 To resolve read-write and write-write conflict issues
 To preserve database consistency through constantly preserving execution obstructions
 The system needs to control the interaction among the concurrent transactions. This
control is achieved using concurrent-control schemes.
 Concurrency control helps to ensure serializability

QUESTION 4
Explain Dirty read problem.
Dirty read is a read of uncommitted data. If a particular row is modified by another running
application and not yet committed, we also run an application to read the same row with the same
uncommitted data. This is the state we say it as a dirty read.
The one main thing is that the dirty reader has to stop reading dirty.
We can try to use the shared locks to prevent other transactions to modify the row, if one is carried
out here.
Example of dirty read problem
A dirty read occurs when a transaction reads data that has not yet been committed.
Example 1
 Step 1 − Consider we have an online shopping system where users can buy and view
the buyer products at the same time.
 Step 2 − Let us suppose a case in which a user tries to buy a product , and as soon as
the user buys the product then the count value in update stock will change
immediately.
 Step 3 − Let us consider that there were 10 items in stock, but now they are 9.
 Step 4 − Moreover due to this transaction, there will also be communication with the
billing gateway.
 Step 5 − Meanwhile, if there is any other user who has also done a transaction at the
same time, the new user will be able to see 9 items in the stock.
 Step 6 − But, let us suppose that the first user was unable to complete his/her
transactions due to some error or insufficient funds.
 Step 7 − Then, in this case the transaction done by the first user will roll back and
now the value in stock will be 10 again.
 Step 8 − But, when the 2nd user was doing a transaction the no items in stocks were
9.
 Step 9 − This is called DIRTY DATA and this whole problem is called the Dirty
Problem.

QUESTION 5
What is concurrency control?

Concurrency control concept comes under the Transaction in database management system
(DBMS). It is a procedure in DBMS which helps us for the management of two simultaneous
processes to execute without conflicts between each other, these conflicts occur in multi user
systems.
Concurrency can simply be said to be executing multiple transactions at a time. It is required to
increase time efficiency. If many transactions try to access the same data, then inconsistency
arises. Concurrency control required to maintain consistency data.
For example, if we take ATM machines and do not use concurrency, multiple persons cannot draw
money at a time in different places. This is where we need concurrency.

QUESTION 6
What is Lost Update problem?

A lost update occurs when two different transactions are trying to update the same column on
the same row within a database at the same time. Typically, one transaction updates a
particular column in a particular row, while another that began very shortly afterward did
not see this update before updating the same value itself. The result of the first transaction is
then "lost," as it is simply overwritten by the second transaction.
QUESTION 7
Explain validation-Based Protocol.

Validation phase is also known as optimistic concurrency control technique. In the validation based
protocol, the transaction is executed in the following three phases:

1. Read phase: In this phase, the transaction T is read and executed. It is used to read the
value of various data items and stores them in temporary local variables. It can perform all
the write operations on temporary variables without an update to the actual database.
2. Validation phase: In this phase, the temporary variable value will be validated against the
actual data to see if it violates the serializability.
3. Write phase: If the validation of the transaction is validated, then the temporary results are
written to the database or system otherwise the transaction is rolled back.

B. Tech. CSE Second Year


Semester 3 Fall-2022-23
Subject: DBMS

ASSIGNMENT OF UNIT 6

Sec. Admission No. Name of Student

5 21SCSE1010810 Mohit Singh Bisht

Subject Teacher:
Mrs Parvesh
QUESTION 1
What do you mean by research?

Research databases are organized collections of computerized information or data such as


periodical articles, books, graphics and multimedia that can be searched to retrieve
information. Databases can be general or subject oriented with bibliographic citations,
abstracts, and or full text. The sources indexed may be written by scholars, professionals or
generalists.
Research databases that are retrieved on the World Wide Web are generally non-fee based,
lack in-depth indexing, and do not index proprietary resources. Subscription or commercial
databases are more refined with various types of indexing features, searching capabilities, and
help guides.

Sources of research data

Research data can be generated for different purposes and through different processes.

 Observational data is captured in real-time, and is usually irreplaceable, for


example sensor data, survey data, sample data, and neuro-images.

 Experimental data is captured from lab equipment. It is often reproducible, but


this can be expensive. Examples of experimental data are gene sequences,
chromatograms, and toroid magnetic field data.

 Simulation data is generated from test models where model and metadata are
more important than output data. For example, climate models and economic
models.

 Derived or compiled data has been transformed from pre-existing data points. It


is reproducible if lost, but this would be expensive. Examples are data mining,
compiled databases, and 3D models.

 Reference or canonical data is a static or organic conglomeration or collection of


smaller (peer-reviewed) datasets, most probably published and curated. For
example, gene sequence databanks, chemical structures, or spatial data portals.

QUESTION 2

Explain Quantitative data Analysis


Quantitative data analysis simply means analysing data that is numbers-based – or data
that can be easily “converted” into numbers without losing any meaning.
For example, category-based variables like gender, ethnicity, or native language could all be
“converted” into numbers without losing meaning – for example, English could equal 1,
French 2, etc.
This contrasts against qualitative data analysis, where the focus is on words, phrases and
expressions that can’t be reduced to numbers. If you’re interested in learning about
qualitative analysis

Quantitative analysis is generally used for three purposes.


 Firstly, it’s used to measure differences between groups. For example, the
popularity of different clothing colours or brands.
 Secondly, it’s used to assess relationships between variables. For example,
the relationship between weather temperature and voter turnout.
 And third, it’s used to test hypotheses in a scientifically rigorous way. For
example, a hypothesis about the impact of a certain vaccine.

QUESTION 3
Explain Quantitative data Analysis

Qualitative data is defined as the data that approximates and characterizes.

Qualitative data can be observed and recorded. This data type is non-numerical in nature.
This type of data is collected through methods of observations, one-to-one interviews,
conducting focus groups, and similar methods. Qualitative data in statistics is also known as
categorical data – data that can be arranged categorically based on the attributes and
properties of a thing or a phenomenon.

Qualitative Data Examples


Qualitative data is also called categorical data since this data can be grouped according to
categories.

For example, think of a student reading a paragraph from a book during one of the class
sessions. A teacher who is listening to the reading gives feedback on how the child read that
paragraph. If the teacher gives feedback based on fluency, intonation, throw of words, clarity
in pronunciation without giving a grade to the child, this is considered as an example of
qualitative data.

It’s pretty easy to understand the difference between qualitative and quantitative data.
Qualitative data does not include numbers in its definition of traits, whereas quantitative data
is all about numbers.

 The cake is orange, blue, and black in color (qualitative).


 Females have brown, black, blonde, and red hair (qualitative).
Quantitative data is any quantifiable information that can be used for mathematical
calculation or statistical analysis. This form of data helps in making real-life decisions based
on mathematical derivations. Quantitative data is used to answer questions like how many?
How often? How much? This data can be validated and verified.

Importance of Qualitative Data


Qualitative data is important in determining the particular frequency of traits or
characteristics. It allows the statistician or the researchers to form parameters through which
larger data sets can be observed. Qualitative data provides the means by which observers can
quantify the world around them.

For a market researcher, collecting qualitative data helps in answering questions like, who
their customers are, what issues or problems they are facing, and where do they need to focus
their attention, so problems or issues are resolved.

Qualitative data is about the emotions or perceptions of people, what they feel. In
quantitative data, these perceptions and emotions are documented. It helps the market
researchers understand the language their consumers speak and deal with the problem
effectively and efficiently.

QUESTION 4

Importance of research in social aspect.

Social research refers to the study of individuals and societies and is often used
to identify regularly occurring social patterns in social life. It can be defined as
the systematic understanding of social facts or phenomena. It is used to gather
information on the social world, in order to come up with a course of action or
simply to develop new knowledge. 

The objective of social research is to identify the cause-and-effect relationship


between social problems so that these problems can be solved to enhance
societal welfare. This method of research is employed by researchers and social
scientists for many different reasons, some of which we will explore in this
article. 

The importance of social research

Increases the Welfare of Humanity: Most social science studies are conducted with the
objective of enhancing the welfare of humanity. 
 Can Predict Behavior: Social research helps us understand different people
and societies. Information gathered from social research can help us predict the
behaviour of certain individuals or groups. When we have a good understanding
of a social phenomenon, we may have a better idea of how to govern or guide
it. 
 Helps Expand or Rectify Current Knowledge: Social research adds to the
knowledge we currently have, and can also be used to test or very old social
fact or beliefs. 
 Provides an Understanding of Social Life: Social research is used to gather
information on social phenomena. It provides us with an understanding of the
social life of different groups of individuals. 
 Structural Changes: Social research can be used to bring planned structural
changes to social life. 
 Precipitates Social Progress: Social research helps us obtain appropriate and
reliable knowledge on social structures and social groups. This information can
be used to disintegrate prejudices, misconceptions, and superstitions,
precipitating social progress and creating a more inclusive society. 
 Formulates New Theories: Social research allows us to formulate new theories
in different fields of study. There are many existing theories on leadership,
motivation, and human behaviour that wouldn’t exist if it wasn’t for social
research. 
 Helps Develop Methodologies: Social research has been used over time to
create methodologies to deal with social problems such as drug addiction,
worker ethic, leadership style, child labour, and is continually used to revise old
methodologies or to create new ones.

You might also like