Assighnment:-3: Submitted To: Submitted BY

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 5

ASSIGHNMENT:-3

MANAGING
DATABASE
SUBMITTED TO: SUBMITTED
BY:
Respected Varun
Katoch
Gargi mam RE3801B53
CAP 200

CAP200 Managing Database


Homework3
Part A

Q1. Declare
a number := 5; b number := null; c number := 10;
Begin
if a > b AND a < c then
a := c * a;
end if;
End;
What will be the value of 'a' after execution ?

Ans1

Pl/sql executed a =50

Q2. Create the circumstances in which you would choose to use embedded
SQL rather than SQL alone or only a general-purpose programming
language.
Ans 2
Writing queries in SQL is typically much easier than coding the same
queries in a general-purpose programming language. However not all
kinds of queries can be written in SQL. Also nondeclarative actions such
as printing a report, interacting with a user, or sending the results of a
query to a graphical user interface cannot be done from within SQL.
Under circumstances in which we want the best of both worlds, we can
choose embedded SQL or dynamic SQL, rather than using SQL alone or
using only a general-purpose programming language.
Embedded SQL has the advantage of programs being less complicated
since it avoids the clutter of the ODBC or JDBC function calls, but
requires a specialized preprocessor.

Q3. Construct an E-R diagram for a hospital with a set of patients and a set
of medical doctors. Associate with each patient a log of the various
tests and examinations conducted.
Ans 3

Part B
Q4 Construct an ER diagram for a car insurance company that has a set of
customers, each of whom owns one/more cars. Each car has associated
with it zero to any number of recorded accidents.
Construct appropriate tables for the above ER diagram.
Ans 4
Q5. Design a testing interface for serializability with respect to concurrency
control schemes. How will you determine, whether a schedule is
serializable or not.
Also Determine the following concurrency control:
(i) Lock based protocol
(ii) Time stamp based protocol
Ans 5

Concurrency control is the management of contention for data resources. A


concurrency control scheme is considered pessimistic when it locks a given resource early
in the data-access transaction and does not release it until the transaction is closed. A
concurrency control scheme is considered optimistic when locks are acquired and
released over a very short period of time at the end of a transaction.

The objective of optimistic concurrency is to minimize the time over which a given
resource would be unavailable for use by other transactions. This is especially important
with long-running transactions, which under a pessimistic scheme would lock up a
resource for unacceptably long periods of time.

LOCK BASED PROTOCOL:-


A locking protocol is a set of rules to be followed by each transaction to ensure that, even
though actions of several transactions might be interleaved,the net effect is
identical to executing all transactions in some serial order.
Time stamp based protocol:- The Time-Stamp Protocol, or TSP is a
cryptographic protocol for certifying timestamps using X.509 certificates and
public key infrastructure. The timestamp is the signer's assertion that a piece
of electronic data existed at or before a particular time.

You might also like