Download lock-X

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Oracle Database wikipedia , lookup

Relational algebra wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

IMDb wikipedia , lookup

Commitment ordering wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Entity–attribute–value model wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Database wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

Serializability wikipedia , lookup

ContactPoint wikipedia , lookup

Clusterpoint wikipedia , lookup

Concurrency control wikipedia , lookup

Relational model wikipedia , lookup

Database model wikipedia , lookup

Transcript
QUESTION BANK (DBMS)
UNIT I
1. Define the concept of “database schema.” Describe the types of schemas that exist in a
database complying with the three levels ANSI/SPARC architecture.
2. List four significant differences between a file-processing system and a DBMS.
3. List five responsibilities of a database management system. For each responsibility, explain
the problems that would arise if the responsibility were not discharged.
4. What do understand by the term ’data model’? Explain the difference between a data
model and its implementation. Why is the difference important?
5. What three main types of actions involve databases? Briefly discuss each.
6. What is the difference between logical data independence and physical data independence?
7. What is the difference between procedural and nonprocedural DMLs?
8. Discuss the different types of user-friendly interfaces and the types of users who typically use
each.
9. Discuss some types of database utilities and tools and their functions.
10. Distinguish between strong and weak entity?
11. Should a real world object be modelled as an entity or as an attribute?
12. Construct an E-R diagram for a car-insurance company whose customers own one or more
cars each. Each car has associated with it zero to any number of recorded accidents.
13. 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.
14. We can convert any weak entity set to a strong entity set by simply adding appropriate
attributes. Why, then, do we have weak entity sets?
UNIT II
1. Describe the differences in meaning between the terms relation and relation schema. Illustrate
your answer by an example.
2. Discuss the characteristics of relations that make them different from ordinary tables and files.
3. Why are duplicate tuples not allowed in a relation?
4. Why are tuples in a relation not ordered?
5. What is the difference between a key and a superkey?
6. Discuss the various reasons that lead to the occurrence of null values in relations.
7. Define foreign key. What is this concept used for? How does it play a role in the join
operation?
8. Does the relational model, as seen by an SQL query writer, provide physical and logical data
independence? Explain.
9. What is the difference between a candidate key and the primary key for a given relation? What
is a superkey?
10. Answer each of the following questions briefly. The questions are based on the following
relational schema:
Emp(eid: integer, ename: string, age: integer, salary: real)
Works(eid: integer, did: integer, pct time: integer)
Dept(did: integer, dname: string, budget: real, managerid: integer)
a. Give an example of a foreign key constraint that involves the Dept relation. What are the
options for enforcing this constraint when a user attempts to delete a Dept tuple?
b. Write the SQL statements required to create the above relations, including appropriate
versions of all primary and foreign key integrity constraints.
11. Given two relations R1 and R2, where R1 contains N1 tuples, R2 contains N2 tuples, and N2
> N1 > 0, give the minimum and maximum possible sizes (in tuples) for the result relation
produced by each of the following relational algebra expressions. In each case, state any
assumptions about the schemas for R1 and R2 that are needed to make the expression
meaningful:
(1) R1 U R2, (2) R1 Π R2, (3) R1−R2, (4) R1 X R2, (5) ϭa=5(R1), (6) Πa(R1), and (7) R1=R2
12. What is relational completeness? If a query language is relationally complete, can you write
any desired query in that language?
13. What is an unsafe query? Give an example and explain why it is important to disallow such
queries.
UNIT III
1. Explain what is meant by repetition of information and inability to represent information.
Explain why each of these properties may indicate a bad relational database design.
2. Suppose that we decompose the schema R = (A, B, C, D, E) into
(A, B, C)
(A, D, E)
Show that this decomposition is a lossless-join decomposition if the following set F of functional
dependencies holds:
A → BC
CD → E
B→D
E→A
3. Use the definition of functional dependency to argue that each of Armstrong’s axioms
(reflexivity, augmentation, and transitivity) is sound.
4. Give a set of FDs for the relation schema R(A,B,C,D) with primary key AB under which R is
in 1NF but not in 2NF.
5. Give a set of FDs for the relation schema R(A,B,C,D) with primary key AB under which R is
in 2NF but not in 3NF.
6. Consider the relation schema R(A,B,C), which has the FD B->C. If A is a candidate key for R,
is it possible for R to be in BCNF? If so, under what conditions? If not, explain why not.
7. Suppose that we have a relation schema R(A,B,C) representing a relationship between two
entity sets with keys A and B, respectively, and suppose that R has (among others) the FDs A->B
and B->A. Explain what such a pair of dependencies means (i.e., what they imply about the
relationship that the relation models).
8. Consider a relation R with five attributes ABCDE. You are given the following dependencies:
A-> B, BC ->E, and ED ->A.
a. List all keys for R.
b. Is R in 3NF?
c. Is R in BCNF?
9. Describe the purpose of normalizing the data? Describe the types of anomalies that may occur
on a relation that has redundant data?
10. Give an example of a relation which is in 3NF but not in BCNF? How will you convert that
relation to BCNF?
11. Given a relation R(S, B, C, D) with key={S, B, D} and F={S → C}. Identify the normal form
of the relation R?
12. List the three design goals for relational databases, and explain why each is desirable.
13. Give an example of a relation schema R and a set of dependencies such that R is in BCNF,
but is not in 4NF.
14. Explain why 4NF is a normal form more desirable than BCNF.
15. Explain how dangling tuples may arise. Explain problems that they may cause.
UNIT IV
1. List the ACID properties. Explain the usefulness of each.
2. Suppose that there is a database system that never fails. Is a recovery manager required for this
system?
3. Database-system implementers have paid much more attention to the ACID properties than
have file-system implementers. Why might this be the case?
4. Explain the distinction between the terms serial schedule and serializable schedule.
5. Since every conflict-serializable schedule is view serializable, why do we emphasize conflict
serializability rather than view serializability?
6. Under what conditions is it less expensive to avoid deadlock than to allow deadlocks to occur
and then to detect them?
7. If deadlock is avoided by deadlock avoidance schemes, is starvation still possible? Explain
your answer.
8. What is meant by the concurrent execution of database transactions in a multiuser system?
Discuss why concurrency control is needed, and give informal examples.
9. Discuss the different types of failures. What is meant by catastrophic failure?
10. What is the system log used for? What are the typical kinds of records in a system log? What
are transaction commit points, and why are they important?
11. What is a schedule (history)? Define the concepts of recoverable, cascadeless, and strict
schedules, and compare them in terms of their recoverability.
12. Discuss the different measures of transaction equivalence. What is the difference between
conflict equivalence and view equivalence?
13. Discuss the different measures of transaction equivalence. What is the difference between
conflict equivalence and view equivalence?
14. Discuss how serializability is used to enforce concurrency control in a database system. Why
is serializability sometimes considered too restrictive as a measure of correctness for schedules?
15.What is meant by the concurrent execution of database transactions in a multiuser system?
Discuss why concurrency control is needed, and give informal examples.
16. Discuss the different types of failures. What is meant by catastrophic failure?
17. Discuss the actions taken by the read_i tern and wri te_i tern operations on a database.
18.What is the system log used for? What are the typical kinds of records in a system log? What
are transaction commit points, and why are they important?
19.Discuss the atomicity, durability, isolation, and consistency preservation properties of a
database transaction.
20.What is a schedule (history)? Define the concepts of recoverable, cascadeless, and strict
schedules, and compare them in terms of their recoverability.
21.Discuss the different measures of transaction equivalence.
22.What is a serial schedule? What is a serializable schedule? Why is a serial schedule
considered correct? Why is a serializable schedule considered correct?
23.Discuss how serializability is used to enforce concurrency control in a database system. Why
is serializability sometimes considered too restrictive as a measure of correctness for schedules?
24.Describe the four levels of isolation in SQL.
DBMS(2013)
1.(a) distinguish between two types of constraints on relationship types?
Ans: There are two main types of relationship constraints, cardinality ratio, and participation.
 The cardinality ratio specifies the maximum number of relationship instances that an entity can
participate in.
 The possible cardinality ratios for binary relationship types are: 1:1, 1:N, N:1, M:N.
 Cardinality ratios are shown on ER diagrams by displaying 1, M and N on the diamonds.
 The participation constraint specifies whether the existence of an entity depends on its being related
to another entity via the relationship type.
 The constraint specifies the minimum number of relationship instances that each entity can participate
in.
 There are two types of participation constraints:
o Total:
 If an entity can exist, only if it participates in at least one relationship instance, then
that is called total participation, meaning that every entity in one set, must be related
to at least one entity in a designated entity set.
 An example would be the Employee and Department relationship. If company
policy states that every employee must work for a department, then an employee can
exist only if it participates in at lest one relationship instance (i.e. an employee can’t
exist without a department)
 It is also sometimes called an existence dependency.
 Total participation is represented by a double line, going from the relationship to the
dependent entity.
Partial:
 If only a part of the set of entities participate in a relationship, then it is called partial
participation.
 Using the Company example, every employee will not be a manager of a department,
so the participation of an employee in the “Manages” relationship is partial.
 Partial participation is represented by a single line.
(b) Discuss how serializability is used to enforce concurrency control in a database system?
Ans: enforce serializability:
– Locking (pessimistic concurrency control).
– Time stamping (optimistic concurrency
control).
(c) Define BCNF? Why is it considered a stronger form of 3NF?
Ans: A relation is in Boyce-Codd Normal Form (BCNF) if every determinant is a candidate key.
Let R be a relation schema, F be the set of FDs given over R, then for every FD X →A in F, X should be
a candidate key.
BCNF is also sometimes referred to as 3.5NF, or 3.5 Normal Form.
BCNF is really an extension of 3rd Normal Form (3NF). For this reason it is frequently termed 3.5NF.
3NF states that all data in a table must depend only on that table’s primary key, and not on any other field
in the table. At first glance it would seem that BCNF and 3NF are the same thing. However, in some rare
cases it does happen that a 3NF table is not BCNF-compliant. This may happen in tables with two or
more overlapping composite candidate keys.
A relation R is in 3NF if and only if every dependency A->B satisfied by R meets at least ONE of the
following criteria: 1. A->B is trivial (i.e. B is a subset of A) 2. A is a superkey 3. B is a subset of a
candidate key BCNF doesn't permit the third of these options. Therefore BCNF is said to be stronger than
3NF because 3NF permits some dependencies which BCNF does not.
(d) Mention functions of DBA in DBMS?
Ans:
1. Selection of hardware and software
2. Managing data security and privacy
3. Managing Data Integrity
4. Data backup
5. Database recovery
6. Tuning database performance
7. Improving query processing performance
2.What is Query optimization?
Ans: Query Processing: Activities involved in retrieving data from the database.
Aims of QP:
o transform query written in high-level language (e.g.SQL), into correct and efficient execution strategy
expressed in low-level language (implementing RA);
o execute the strategy to retrieve required data.
Query Optimization: Activity of choosing an efficient execution strategy for processing query.
o As there are many equivalent transformations of same high-level query, aim of QO is to choose one
that minimizes resource usage.
o Generally, reduce total execution time of query.
o Problem computationally intractable with large number of relations, so strategy adopted is reduced
to finding near optimum solution.
DBMS
1.(a)differentiate between a database schema and a database state?
Ans: The distinction between database schema and database state is very important. When we
define a new database, we specify its database schema only to the DBMS. At this point, the
corresponding database state is the empty state with no data. We get the initial state of the
database when the database is first populated or loaded with the initial data. From then on, every
time an update operation is applied to the database, we get another database state. At any point in
time, the database has a current state. The DBMS is partly responsible for ensuring that every
state of the database is a valid state-that is, a state that satisfies the structure and constraints
specified in the schema. The DBMS stores the descriptions of the schema constructs and
constraints-also called the meta-data-in the DBMS catalog so that DBMS software can refer to
the schema whenever it needs to. The schema is sometimes called the intension, and a database
state an extension of the schema.
(b)What is Participation role?Is it necessary to use the role names in the description of relationship types?
Justify.
Participation role signifies role that a participating entity from the entity type plays in each relationship
instance, and helps to explain that relationship means. Using Role name is not necessary in the description
of relationship types where all participating entities are distinct because in such case name of entity types
generally specify the role played by each entity type. But when one entity type participate in a relation in
more than one role; recursive relationship; it becomes necessary to use role names in the description of
relationship type.
(c)What are the tuples in a relation not ordered?
(d)distinguish between Inner join and Outer join.
Ans: In SQL, a join is used to compare and combine — literally join — and return specific rows
of data from two or more tables in a database. An inner join finds and returns matching data
from tables, while an outer join finds and returns matching data and some dissimilar data from
tables.
Inner Join
An inner join focuses on the commonality between two tables. When using an inner join, there
must be at least some matching data between two (or more) tables that are being compared. An
inner join searches tables for matching or overlapping data. Upon finding it, the inner join
combines and returns the information into one new table.
Outer Join
An outer join returns a set of records (or rows) that include what an inner join would return but
also includes other rows for which no corresponding match is found in the other table.
There are three types of outer joins:
Left Outer Join (or Left Join)
Right Outer Join (or Right Join)
Full Outer Join (or Full Join)
Each of these outer joins refers to the part of the data that is being compared, combined, and
returned. Sometimes null will be produced in this process as some data is shared while other data
is not.
(e) When are two sets of functional dependencies equivalent? How can we determine their
equivalence?
Ans: In minimal cover, two sets of FDs are equivalent.
To determine their equivalence, we need to prove that F+ = G+. However, since computing F+ or
G+ is computationally expensive we take a short cut. We can conclude that F and G are
equivalent, if we can prove that all FDs in F can be inferred from the set of FDs in G and vice
versa.
(f)What is a serializable schedule? Is it same as Serial schedule? Juystify
Ans:
DBMS(2013)
2. Explain and differentiate between 2-tier and 3-tier architectures for DBMS with suitable
example.
Ans: Traditional two-tier client–server architecture
–
Client process requires some resource
–
–
–
Server provides the resource
Basic separation of four main components of business application
Typical interaction between client and server
Three-tier client–server architecture
User interface layer
Business logic and data processing layer
DBMS
Many advantages over traditional two-tier or single-tier designs
Two-tier architecture is a client/server architecture , where a request to do some task is sent to
the server and the server responds by performing the task.where as a three-tier or a multi tier
architecture has client, server and database. Where the client request is sent to the server and the
server in turn sends the request to the database. The database sends back the information/data
required to the server which inturn sends it to the client.
3.SHADOW PAGING
This recovery scheme does not require the use of a log in a single-user environment. In a
multiuser environment, a log may be needed for the concurrency control method. Shadow paging
considers the database to be made up of a number of fixed-size disk pages (or disk blocks)—say,
n—for recovery purposes. A directory with n entries is constructed, where the i th entry points to
the i th database page on disk. The directory is kept in main memory if it is not too large, and all
references—reads or writes—to database pages on disk go through it. When a transaction begins
executing, the current directory—whose entries point to the most recent or current database
pages on disk—is copied into a shadow directory. The shadow directory is then saved on disk
while the current directory is used by the transaction.
During transaction execution, the shadow directory is never modified. When a write_item
operation is performed, a new copy of the modified database page is created, but the old copy of
that page is not overwritten. Instead, the new page is written elsewhere—on some previously
unused disk block. The current directory entry is modified to point to the new disk block,
whereas the shadow directory is not modified and continues to point to the old unmodified disk
block. For pages updated by the transaction, two versions are kept. The old version is referenced
by the shadow directory, and the new version by the current directory.
To recover from a failure during transaction execution, it is sufficient to free the modified
database pages and to discard the current directory. The state of the database before transaction
execution is available through the shadow directory, and that state is recovered by reinstating the
shadow directory. The database thus is returned to its state prior to the transaction that was
executing when the crash occurred, and any modified pages are discarded. Committing a
transaction corresponds to discarding the previous shadow directory. Since recovery involves
neither undoing nor redoing data items, this technique can be categorized as a NO-UNDO/NOREDO technique for recovery.
In a multiuser environment with concurrent transactions, logs and checkpoints must be
incorporated into the shadow paging technique. One disadvantage of shadow paging is that the
updated database pages change location on disk. This makes it difficult to keep related database
pages close together on disk without complex storage management strategies. Furthermore, if the
directory is large, the overhead of writing shadow directories to disk as transactions commit is
significant. A further complication is how to handle garbage collection when a transaction
commits. The old pages referenced by the shadow directory that have been updated must be
released and added to a list of free pages for future use. These pages are no longer needed after
the transaction commits. Another issue is that the operation to migrate between current and
shadow directories must be implemented as an atomic operation.
4. Discuss the different types of transaction failures. What is meant by catastrophic failure?
Ans: A catastrophic failure is a sudden and total failure from which recovery is impossible.
Catastrophic failures often lead to cascading systems failure.
The recovery manager of a DBMS must also be equipped to handle more catastrophic failures
such as disk crashes. The main technique used to handle such crashes is that of database backup.
The whole database and the log are periodically copied onto a cheap storage medium such as
magnetic tapes. In case of a catastrophic system failure, the latest backup copy can be reloaded
from the tape to the disk, and the system can be restarted.
To avoid losing all the effects of transactions that have been executed since the last backup, it is
customary to back up the system log at more frequent intervals than full database backup by
periodically copying it to magnetic tape. The system log is usually substantially smaller than the
database itself and hence can be backed up more frequently. Thus users do not lose all
transactions they have performed since the last database backup. All committed transactions
recorded in the portion of the system log that has been backed up to tape can have their effect on
the database redone. A new log is started after each database backup. Hence, to recover from
disk failure, the database is first recreated on disk from its latest backup copy on tape. Following
that, the effects of all the committed transactions whose operations have been recorded in the
backed-up copies of the system log are reconstructed.
Unit- I
1. What is Data?
A. Data is a collection of raw information.
2. What is Information?
A. Information is a collection of processed data
3. What is Database?
A. Database is a collection of inter-related data items that can be processed by one or more
application systems.
4. What is DBMS?
A. Database Management System is a collection of interrelated data and set of programs to
access
those data. The DBMS is a general purpose software system that facilitates the process of
defining constructing and manipulating databases for various applications.
5. What are the disadvantages of File Oriented System?
A. The typical file-oriented system is supported by a conventional operating system. Permanent
records are stored in various files and a number of different application programs are written to
extract records from and add records to the appropriate files.
The following are the disadvantages of File-Oriented System:
(i). Data redundancy and Inconsistency: Since files and application programs are created by
different programmers over a long period of time, the files are likely to be have different formats
and
the programs may be written in several programming languages. Moreover, the same piece of
information may be duplicated in several places. This redundancy leads to higher storage and
access
cost. In addition, it may lead to data inconsistency, i.e. the various copies of same data may no
longer agree.
(ii). Difficulty in accessing data: the conventional file processing environments do not allow
needed
data to be retrieved in a convenient and efficient manner. Better data retrieval system must be
developed for general use.
(iii). Data isolation: Since data is scattered in various files, and files may be in different formats,
it is
difficult to write new application programs to retrieve the appropriate data.
(iv). Concurrent access anomalies: In order to improve the overall performance of the system
and
obtain a faster response time, many systems allow multiple users to update the data
simultaneously.
In such an environment, interaction of concurrent updates may result in inconsistent data.
(v). security problems: Not every user of the database system should be able to access all the
data.
For example, in banking system, payroll personnel need only that part of the database that has
information about various bank employees. They do not need access to information about
customer
accounts. It is difficult to enforce such security constraints.
(vi). Integrity problems: The data values stored in the database must satisfy certain types of
consistency constraints. For example, the balance of a bank account may never fall below a
prescribed amount. These constraints are enforced in the system by adding appropriate code in
the
various application programs. When new constraints are added, it is difficult to change the
programs
to enforce them. The problem is compounded when constraints involve several data items for
different files.
(vii). Atomicity problem: A computer system like any other mechanical or electrical device is
subject to failure. In many applications, it is crucial to ensure that once a failure has occurred and
has
been detected, the data are restored to the consistent state existed prior to the failure.
6. What are the advantages of DBMS over File Oriented System?
A. The following are the advantages of DBMS:
I. Data Redundancy: A major difficulty was that many applications used their own special files
of data. Thus, some data items were common to several applications. In a bank, for example,
the same customer name might appear in a checking account file, a savings account file and an
installment loan file. Moreover, even though it was always the customer name, the related field
often had a different name in the various account files. Thus, CNAME in the checking account
file became SNAME in the savings account file and INAME in the installment loan file. The
same field also has a different length in the various files. For example, CNAME could be up to
20 characters,
but SNAME and INAME might be limited to 15 characters. This redundancy increased the
overhead costs of maintenance and storage. Data redundancy also increased the risk of
inconsistency among the various versions of common data.
Suppose a customer’s name was changed. The name field might be immediately
updated in the checking account file, updated next week in the savings account file and updated
incorrectly in the installment loan file. Over time, such discrepancies can cause serious
degradation in the quality of information contained in the data files.
Database systems can eliminate data redundancy, since all applications share a common
pool of data. Essential information such as customer name will appear just once in the database.
Thus, we can enter a name or change once and know that applications will be accessing
consistent data.
II. Poor Data Control: In the file system, there was no centralized control at the data element
level. It was very common for the same data element to have multiple names, depending on the
file it was in.
At a more fundamental level, there is always the chance that the various departments of
a company will be inconsistent in their terminology.
III. Inadequate Data Manipulation Capabilities: Indexed sequential files allow the
applications to access a particular record by a key such as ProductID. For example, if we knew
the ProductID for the table, it is easy to access a record in the table. Suppose we want a set of
records. It is not possible to obtain a set of records using file system because they are unable to
provide strong connections between data in different files. Database systems were specifically
developed to make the interrelating of data in different files.
IV. Excessive Programming Effort: A new application program often required an entirely new
set of file definitions. Even though an existing file may contain some of the data needed, the
application often required a number of other data items. As a result, the programmer had to
recode the definitions of needed data items from the existing file as well as definitions of all new
data items. Thus, in file-oriented systems, there was a heavy interdependence between programs
and data.
Database provides a separation between programs and data, so that programs can be
somewhat independent of the details of data definition. By providing access to a pool of shared
data and by supporting powerful data manipulating languages, database systems eliminate a
large amount initial and maintenance programming.
7. What is Instance and Schema?
A. Instance: The collection of information stored in the database at a particular moment is called
an
instance of the database.
Schema: The overall design of the database is called the database schema.
8. What is Data Independence?
A. Data Independence: The ability to modify a schema definition in one level without effecting
a
schema definition in the next level is called Data Independence.
There are two levels of data independence:
(i). Physical Data Independence: The ability to modify the physical schema without causing
application programs to be rewritten.
(ii). Logical Data Independence: The ability to modify the conceptual schema without causing
application programs to be rewritten.
Logical Data Independence is more difficult to achieve than physical data independence
since application programs are heavily dependent on the logical structure of the data they access.
9. What is a data model?
Data Model: A conceptual method of structuring data is called Data Model.
The development of systems based on three principal data models. These three models are the
Hierarchical, the Network and the Relational.
10. Explain the components of Database System.
A. A complete database system in an organization consists of four components.
(i). Hardware: The hardware is the set of physical devices on which a database resides. It
consists of one or more computers, disk drives, CRT terminals, printers, tape drivers, connecting
cables, etc.
The computers used for processing the data in the database may be mainframe, mini
computers or personal computers. Mainframe and mini computers have traditionally been used
on a stand-alone basis to support multiple users accessing a common database. Personal
computers are often used with stand-alone databases controlled and accessed by a single user.
Disk drivers are the main storage mechanism for databases. Desktop computers, CRT
terminals and printers are used for entering and retrieving information from the database.
The success of the database system has been heavily dependent on advances in
hardware technology. A very large amount of main memory and disk storage is required to
maintain and control the huge quantity of data stored in a database.
(ii). Software: A database system includes two types of software:
a. General Purpose database management software usually called the database
management system (DBMS).
b. Application software that uses DBMS facilities to manipulate the database to achieve a
specific business functions.
Application software is generally written by programmers to solve a specific company
problem. It may be written in languages like COBOL or C or it may be written in a language
supplied by DBMS like SQL. Application software uses the facilities of the DBMS to access
and manipulate data in the database providing reports or documents needed for the
information and processing needs of the company.
The DBMS is system software similar to an operating system. It provides a number of
services to end users and programmers.
DBMS typically provides most of the following services.
1. A central data definition and data control facility known as a data dictionary/directory or
catalog.
2. Data security and integrity mechanisms.
3. Concurrent data access for multiple users.
4. User-oriented data query, manipulation and reporting capabilities.
5. Programmer-oriented application system development capabilities.
(iii). Data: No database system can exist without data. Data can be collected and entered into
the database according to the defined structure.
(iv). People: Two different types of people concerned with the database.
They are:
1. Users: Executives, Managers, Staff, Clerical personnel.
2. Practitioners: Database Administrators, Programmers.
11. What is Data Dictionary?
A. A data dictionary / directory subsystem keeps track of the definitions of all the data items in
the
database. This includes elementary-level data items (fields), group and record-level data
structures
and relational tables. It keeps track of relationships that exist between various data structures. It
maintains the indexes that are used to access data quickly. It also keeps track of screen and report
format definitions that may be used by various application programs.
12. Explain Data Sharing
A.
Data without sharing:
The most significant difference between a file-based system and a database system is that data
are shared.
There are three types of data sharing:
(i). Sharing between Functional Units: The data sharing suggests that people in different
functional areas use common pool of data, each of their own applications. Without data sharing,
the
marketing group may have their data files, the purchasing group theirs, the accounting group
theirs
and so on. Each group benefits only from its own data. The combined data are more valuable
than the
sum of the data in separate files. Not only does each group continue to have access to its own
data
but, within reasonable limits of control, they have access to other data as well. The concept of
combining data for common use is called data integration.
(iii). Sharing data between Different Locations: A company with several locations has
important
data distributed over a wide geographical area. Sharing these data is a significant problem.
A centralized database is physically confined to a single location, controlled by a single
computer. Most functions for the databases are created are accomplished more easily if the
database is
centralized. That is, it is easier to update, back up, query and control access to a database if we
know
exactly where it is and what software controls it.
14. Explain the functions of DBA.
A. Database Administrator is a person with the responsibility of controlling and protecting the
data. The DBA should coordinate the design of the database, guide the development and
implementation of data security procedures, protect the integrity of data values and make sure
system performance is satisfactory.
In a small organization, one person carries out all these responsibilities. Often, these functions
are assigned to a group of people. This is most likely in a large organization where DBA
responsibilities are divided among several people managed by a chief administrator.
The functions of DBA include:
(i). Database Design: Conceptual Database Design consists primarily of defining the data
elements to be included in the database, the relationship that exists between them and the value
constraints apply. A value constraint is a rule defining the permissible values for a specific data
items.
Physical Database Design determines the physical structure of the database and includes such
decisions as what access methods will be used to retrieve data and what indexes will be built to
improve the performance of the system.
(ii). User Training: The DBA is responsible for educating users in the structure of the database
and
in its access through the DBMS. This can be done in formal training sessions by interacting with
users
to create database views, through user’s manuals and periodic memos and through company
information centers. An information center is an area where users are provided with facilities to
do
their own computing.
(iii). Database Security and Integrity: The concept of combining an organization’s data into
one
common pool accessible to all has both advantages and disadvantages. The obvious advantage of
data sharing is offset by the disadvantage that data can be misused or damaged by the users who
do
not have original responsibility and authority over the data. The DBA provides procedures and
controls to prevent the abuse of data.
Access of database is ultimately controlled by a password mechanism, whereby a user attempting
access gives a system-validates password. The system allows the validated user only those access
rights recorded in the data dictionary. The DBA is responsible for assigning passwords and
controlling
privileges. Data integrity refers to the problems of maintaining the accuracy and consistency of
data
values. Security mechanisms such as passwords and data views protect data integrity.
(iv). Database System Performance: A database system being simultaneously accessed by
many
users may respond very slowly at times because the physical problems associated with users
competing for the same resources are not trivial. Thus, the DBA staff should include technically
skilled
15. (a) Explain the concept of data abstraction.
Data Abstraction:
For the system to be usable, it must retrieve data efficiently. The need for efficiency has led
designers to use complex data structures to represent data in the database. Since many databasesystems users are not computer trained, developers hide the complexity from users through
several levels of abstraction, to simplify users’ interactions with the system:
1. physical level
2. Logical level
3. View level
(b) Define a schema with example.
Ans:
A schema is a logical data base description and is drawn as a chart of the types of data that are
used . It gives the names of the entities and attributes and specify the relationships between
them.
A database schema includes such information as :
Characteristics of data items such as entities and attributes .
Logical structures and relationships among these data items .
Format for storage representation.
Integrity parameters such as physical authorization and back up policies.
Example:
STUDENT(rollno (primary key),name, address)
(c) Strong entity:
An entity whch have key attribute is called strong entity.
Example:
Loan(loanno,amount,loan type)
Weak Entity:
Entity types that do not contain any key attribute, and hence can not be identified independently
are called weak entity types. A weak entity can be identified by uniquely only by considering
some of its attributes in conjunction with the primary key attribute of another entity, which is
called the identifying owner entity.
Example:
Payment(pslno,pmtamt,pdate)
(d) Distinguish between physical data independency and logical data independency.
Answer:
• Physical data independence is the ability to modify the physical scheme without making it
necessary to rewrite application programs. Such modifications include changing from unblocked
to blocked record storage, or from sequential to random access files.
• Logical data independence is the ability to modify the conceptual scheme without making it
necessary to rewrite application programs. Such a modification might be adding a field to a
record; an application program’s view hides this change from the program.
(e) Define second normal form of relational database system.
Ans:
Defn: A relation scheme R<S,F> is in second normal form(2NF) if it is in the !NF and if all non prime
attributes are fully functionally dependent on the relation keys.
A relation is said to be in2NF if it is in 1NF and non-key attributes are functionally dependent on
the key attribute(s). Further. if the key has more than one attribute then no non-key attributes
should be functionally dependent upon a part of the key attributes.
(f) Define timestamp ordering in concurrency control.
Ans:
Timestamps:
With each transaction Ti in the system, we associate a unique fixed timestamp, denoted by
TS(Ti). This timestamp is assigned by the database system before the transaction Ti starts
execution. If a transaction Ti has been assigned timestamp TS(Ti), and a new transaction Tj
enters the system, then TS(Ti) < TS(Tj ). There are two simple methods for implementing this
scheme:
1. Use the value of the system clock as the timestamp; that is, a transaction’s timestampis equal
to the value of the clock when the transaction enters the system.
2. Use a logical counter that is incremented after a new timestamp has been assigned; that is, a
transaction’s timestamp is equal to the value of the counter When the transaction enters the
system.
The timestamps of the transactions determine the serializability order. Thus, if TS(Ti) < TS(Tj ),
then the system must ensure that the produced schedule is equivalent to a serial schedule in
which transaction Ti appears before transaction Tj .
To implement this scheme, we associate with each data item Q two timestamp values:
• W-timestamp(Q) denotes the largest timestamp of any transaction that executed write(Q)
successfully.
• R-timestamp(Q) denotes the largest timestamp of any transaction that executed read(Q)
successfully
(g) What is meant by ER models? Draw an ER diagram for a bank database schema where
a bank can have multiple branches , each branch can have multi accounts and loans.
Ans.
Entity Relationship Model
The entity-relationship data model perceives the real world as consisting of basic objects, called
entities and relationships among these objects. It was developed to facilitate data base design by
allowing specification of an enterprise schema which represents the overall logical structure of a
data base.
Main features of ER-MODEL:





Entity relationship model is a high level conceptual model
It allows us to describe the data involved in a real world enterprise in terms of objects and
their relationships.
It is widely used to develop an initial design of a database
It provides a set of useful concepts that make it convenient for a developer to move from
a baseid set of information to a detailed and description of information that can be easily
implemented in a database system
It describes data as a collection of entities, relationships and attributes.
(h) Define functional dependency. Describe Armstrongs’ axioms of functional dependencies.
Ans:
The functional dependency x->y
Holds on scema R if, in any legal relation r(R ), for all pairs of tuples t1 and t2 in r such that
t1[x]=t2[x]. it is also the case that t1[y]=t2[y]
CLOSURE OF A SET OF FUNCTIONAL DEPEDENCIES
Given a relational schema R, a functional dependencies f on R is logically implied by a set of
functional dependencies F on R if every relation instance r(R) that satisfies F also satisfies f.
The closure of F, denoted by F+, is the set of all functional dependencies logically implied by F.
The closure of F can be found by using a collection of rules called Armstrong axioms.
Reflexivity rule: If A is a set of attributes and B is subset or equal to A, then A→B holds.
Augmentation rule: If A→B holds and C is a set of attributes, then CA→CB holds
Transitivity rule: If A→B holds and B→C holds, then A→C holds.
Union rule: If A→B holds and A→C then A→BC holds
Decomposition rule: If A→BC holds, then A→B holds and A→C holds.
Pseudo transitivity rule: If A→B holds and BC→D holds, then AC→D holds.
(i) Distinguish between equivalence sets of functional dependencies and minimal sets of
functional dependencies.
Ans:
Equivalence sets:
Given two sets of F and G of FDs defined over the same relational schema, we will say that F
and G are equivalents if and only if F+ =G+. We will indicate that F and G are equivalent sets by
writing F=G.
Minimal cover:
For a given set F of FDs, a canonical cover(minimal cover) denoted by Fc, is a set of FDs where
the following condition are simultaneously satisfied.
1. Every FD of Fc is simple. That is the right hand side of every fd of Fc has only on attribute.
2. Fc is left reduced
3. Fc is non redundant
(j) What is meant by normalization of Relational database? Define BCNF. How does it
differ from 3NF? Why is it considered as a stronger from 3NF? Explain with suitable
examples.
NORMALIZATION
The basic objective of normalization is to reduce redundancy which means that information is to
be stored only once. Storing information several times leads to wastage of storage space and
increase in the total size of the data stored. Relations are normalized so that when relations in a
database are to be altered during the life time of the database, we do not lose information or
introduce inconsistencies. The type of alterations normally needed for relations are:
Insertion of new data values to a relation. This should be possible without being forced to leave
blank fields for some attributes.
Deletion of a tuple, namely, a row of a relation. This should be possible without losing vital
information unknowingly.
Updating or changing a value of an attribute in a tuple. This should be possible without
exhaustively searching all the tuples in the relation.
BOYCE CODD NORMAL FORM:
Defn: a normalized relation scheme R<S,F> is in Boyce Codd normal form if for every
nontrivial FD in F+ of the form X→A where X is subset of S and AЄS, X is a super key of R.
How it differs from 3nf:
A relational scheme R<S,F> is in third normal form(3NF) if for all non trivial function
dependencies in F+ of the form X→A, either X contains a key(i.e, X is super key) or A is a
prime key attribute.
But in BCNF for every nontrivial FD in F+ of the form X→A where X is subset of S and AЄS,
X must be a candidate key of R.
BCNF is stronger than 3NF:
A relation schema in 3NF may still have some anomalies under the situations when a schema has
multiple candidate keys, which my be composite and overlapping.
Assume that a relation has more than one possible key. Assume further that the composite keys
have a common attribute. If an attribute of a composite key is dependent on an attribute of the
other composite key, a normalization called BCNF is needed. Consider. as an
example, the relation Professor:
It is assumed that
1. A professor can work in more than one department
2. The percentage of the time he spends in each department is given.
3. Each department has only one Head of Department.
The relationship diagram for the above relation is given in figure 8. Table 6 gives the relation
attributes. The two possible composite keys are professor code and Dept. or Professor code and
Hcad of Dept. Observe that department as well as Head of Dept. are not non-key attributes. They
are a part of a composite key
(k) What is meant by query execution plan? Discuss the main heuristic that are applied during
query optimization process.
Ans:
A sequence of primitive operations that can be used to evaluate a query is a query execution plan
or query-evaluation plan.
Heuristic optimization:
A drawback of cost-based optimization is the cost of optimization itself. Although the cost of
query processing can be reduced by clever optimizations, cost-based optimization is still
expensive. Hence, many systems use heuristics to reduce the number of choices that must be
made in a cost-based fashion. Some systems even choose to use only heuristics, and do not use
cost-based optimization at all.
Cost-based optimization is expensive, even with dynamic programming.
Systems may use heuristics to reduce the number of choices that must be made in a cost-based
fashion.
Heuristic optimization transforms the query-tree by using a set of rules that typically (but not in
all cases) improve execution performance:
Perform selection early (reduces the number of tuples)
Perform projection early (reduces the number of attributes)
Perform most restrictive selection and join operations before other similar operations.
Steps in Typical Heuristic Optimization:
Deconstruct conjunctive selections into a sequence of single selection operations
Move selection operations down the query tree for the earliest possible execution
Execute first those selection and join operations that will produce the smallest relations
Replace Cartesian product operations that are followed by a selection condition by join
operations .
Deconstruct and move as far down the tree as possible lists of projection attributes, creating new
projections where needed.
Identify those sub trees whose operations can be pipelined, and execute them using pipelining.
16.Discuss how serializability is used to enforce concurrency control in a database system.
Ans:
Serializability:
Basic Assumption – Each transaction preserves database consistency.
Thus serial execution of a set of transactions preserves database consistency.
A (possibly concurrent) schedule is serializable if it is equivalent to a serial schedule. Different
forms of schedule equivalence give rise to the notions of:
conflict serializability 2. view serializability
17. The Two-Phase Locking Protocol
One protocol that ensures serializability is the two-phase locking protocol. This protocol requires
that each transaction issue lock and unlock requests in two phases:
1. Growing phase. A transaction may obtain locks, but may not release any lock.
2. Shrinking phase. A transaction may release locks, but may not obtain any new locks.
Initially, a transaction is in the growing phase. The transaction acquires locks as needed. Once
the transaction releases a lock, it enters the shrinking phase, and it can issue no more lock
requests.
For example, transactions T3 and T4 are two phase. On the other hand, transactions T1 and T2
are not two phase. Note that the unlock instructions do not need to appear at the end of the
transaction. For example, in the case of transaction T3, we could move the unlock(B) instruction
to just after the lock-X(A) instruction, and still retain the twophase locking property.
18. Discuss the problems of dead lock and starvation and different approaches to deal with these
problems.
DEADLOCK:
System is deadlocked if there is a set of transactions such that every transaction in the set
is waiting for another transaction in the set.
Recovery from Deadlock:
When a detection algorithm determines that a deadlock exists, the system must recover from the
deadlock. The most common solution is to roll back one or more transactions to break the
deadlock. Three actions need to be taken:
1. Selection of a victim. Given a set of deadlocked transactions, we must determine which
transaction (or transactions) to roll back to break the deadlock. We should roll back those
transactions that will incur the minimum cost. Unfortunately, the term minimum cost is not a
precise one. Many factors may determine the cost of a rollback, including
a. How long the transaction has computed, and how much longer the transaction will compute
before it completes its designated task.
b. How many data items the transaction has used.
c. How many more data items the transaction needs for it to complete.
d. How many transactions will be involved in the rollback.
2. Rollback. Once we have decided that a particular transaction must be rolled back, we must
determine how far this transaction should be rolled back. The simplest solution is a total
rollback: Abort the transaction and then restart it. However, it is more effective to roll back the
transaction only as far as necessary to break the deadlock. Such partial rollback requires the
system to maintain additional information about the state of all the running transactions.
Specially, the sequence of lock requests/grants and updates performed by the transaction needs to
be recorded. The deadlock detection mechanism should decide which locks the selected
transaction needs to release in order to break the deadlock. The selected transaction must be
rolled back to the point where it obtained the .rst of these locks, undoing all actions it took after
that point. The recovery mechanism must be capable of performing such partial rollbacks.
Furthermore, the transactions must be capable of resuming execution after a partial rollback. See
the bibliographical notes for relevant references.
3. Starvation. In a system where the selection of victims is based primarily on cost factors, it may
happen that the same transaction is always picked as a victim. As a result, this transaction never
completes its designated task, thus there is starvation. We must ensure that transaction can be
picked as a victim only a (small) .nite number of times. The most common solution is to include
the number of rollbacks in the cost factor.
19.Consider the following relation:
Customer(cust_name,cust_street,cust_city)
Loan(branch_name,loan_number,amount)
Borrower(cust_name,loan_number,amount)
Write the following quries in SQL for above relation:
Find the name of all customers how have a loan at the “ Redwood” Branch.
Find the branch name,loan number and amount for loans over Rs. 50000/Find the name of all customers who have a loan an account or both at perryridge branch.
Find all customers who have a loan from the bank. Find their names and loan numbers
Find all loan numbers for loan made at redwood branch with loan amounts greater than
Rs.60000.
Ans:
a.
select borrower.cust_name from loan ,borrower where
loan.loan_number=borrower.loan_number and loan.branch_name=’Redwood’
b.
select branch_name,loan_numer,amount from loan where amount>50000
c.
(select customer-name from depositor a ,account b where a.account_no=b.account_no and
b.branch_name=’perryridge’)
union (select customer-name from borrower a,loan b
where loan.loan_number=b.loan_number and b. branch_name=’perryridge’)
d.
select borrower.cust_name,borrower.loan_number from borrower , loan where
borrower.loan_number=loan.loan_number
e.
select a.loan_number from borrower a,loan b where a.loan_number=b.loan_number and
b.branch_name=’perryridge’ and a.amount>60000
20. What is time stamp? If TS(Ti)>TS(Tj) then which transaction is younger? Justify. Consider
TS(Ti) is the time stamp of transaction Ti.
Ans:
Timestamps:
With each transaction Ti in the system, we associate a unique fixed timestamp, denoted by
TS(Ti). This timestamp is assigned by the database system before the transaction Ti starts
execution. If a transaction Ti has been assigned timestamp TS(Ti), and a new transaction Tj
enters the system, then TS(Ti) < TS(Tj ). There are two simple methods for implementing this
scheme:
1. Use the value of the system clock as the timestamp; that is, a transaction’s timestampis equal
to the value of the clock when the transaction enters the system.
2. Use a logical counter that is incremented after a new timestamp has been assigned; that is, a
transaction’s timestamp is equal to the value of the counter When the transaction enters the
system.
Ti is younger then Tj because TS(Ti)>TS(Tj)
21. Consider the set of relations:
Student(name,roll,mark)
Score(roll,grade)
Details(name,address)
For the following qyuery:
“Find name and address of students scoring grade “A”
Represent it in relational algebra, tuple relational calculus, domain relational calculus, QBE &
SQL
Ans:
Relational algebra:
Пdetails.name,details.address(σstudent.roll=score.roll and student.name=details.name and and
score.grade=”A”(studentXscoreXdetails))
Tuple relational calculus:
R={t|
Domain relational calculus:
R={<nm,ad>|
SQL:
Select details.name,details.address from student,score,details where student.roll=score.roll and
student.name=details.name and score.grade=”A”
22. Consider the following set of data items:
A
B
C
D
A1
1
X1
D1
A2
2
X2
D2
A3
3
X3
D3
A3
3
X3
D3
Represent it in 3NF.
Ans:
In this table 4th row is duplicate record of 3rd one. Delete that record before checking for
normalization.
Now the table is in 1NF format.
In this relation all row are uniue.
In this relation all functional dependencies are there like
A→B,B→C,C→D,A→C.A→D,B→D,AB→C,AB→D,…
Here the candidate key is (ABCD)
So it a all key schema.
There is no transitivity dependency so it is 3NF table.
23. What is the difference between 4NF and BCNF. Describe with examples.
Ans:
BCNF:
The criteria for Boyce-Codd normal form (BCNF) are:
* The table must be in 3NF.
* Every non-trivial functional dependency must be a dependency on a superkey.
4NF:
The criteria for fourth normal form (4NF) are:
* The table must be in BCNF.
* There must be no non-trivial multivalued dependencies on something other than a superkey. A
BCNF table is said to be in 4NF if and only if all of its multivalued dependencies are functional
dependencies.
24. What is a constraint ? describe its types with examples
Ans:
Rules which are enforced on data being entered and prevents the user from entering invalid data
into table are called constraints. Thus constraints super control data being entered in tables fro
permanent storage.
RELATIONAL CONSTRAINTS:
There are three types of constraints on relational database that include
DOMAIN CONSTRAINTS
KEY CONSTRAINTS
INTEGRITY CONSTRAINTS
DOMAIN CONSTRAINTS:
It specifies that each attribute in a relation an atomic value from the corresponding domains. The
data types associated with commercial RDBMS domains include:
Standard numeric data types for integer
Real numbers
Characters
Fixed length strings and variable length strings
Thus, domain constraints specifies the condition that we to put on each instance of the relation.
So the values that appear in each column must be drawn from the domain associated with that
column.
Rollno
Name
City
Age
101
Sujit
Bam
23
102
kunal
bbsr
22
Key constraints:
This constraints states that the key attribute value in each tuple msut be unique .i.e, no two tuples
contain the same value for the key attribute.(null values can allowed)
Emp(empcode,name,address) . here empcode can be unique
Integrity constraints:
There are two types of integrity constraints:
Entity integrity constraints
Referential integrity constraints
Entity integrity constraints:
It states that no primary key value can be null and unique. This is because the primary key is
used to identify individual tuple in the relation. So we will not be able to identify the records
uniquely containing null values for the primary key attributes. This constraint is specified on one
individual relation.
Referential integrity constraints:
It states that the tuple in one relation that refers to another relation must refer to an existing tuple
in that relation. This constraints is specified on two relations .
If a column is declared as foreign key that must be primary key of another table.
Department(deptcode,dname)
Here the deptcode is the primary key.
Emp(empcode,name,city,deptcode).
Here the deptcode is foreign key.
25. What is difference between multi valued attributes and derived attribute.
Multi valued attribute:
The attribute having more than one value is multi-valued attribute
eg: phone-no, dependent name, vehicle
Derived Attribute:
The values for this type of attribute can be derived from the values of existing attributes
eg:
age which can be derived from (currentdate-birthdate)
experience_in_year can be calculated as (currentdate-joindate)
26. What is difference between procedural and non procedural language.
Ans:
In dbms the Procedural language specifies how to output of query statement must be obtained
Example:
Relational algebra
In dbms the Non-procedural language specifies what output is to be obtained.
Example:
SQL,QBE
27. What is generalization? How it differs from specialization.
Ans:
Generalization is the abstracting process of viewing set of objects as a single general class by
concentrating on the general characteristics of the constituent sets while suppressing or ignoring
their differences.
Specialization is the abstracting process of introducing new characteristics to an existing class of
objects to create one or more new classes of objects. This involves taking a higher-level, and
using additional characteristics, generating lower-level entities. The lower-level entities also
inherits the, characteristics of the higher-level entity.
28. Explain one of the pessimistic concurrency control scheme with example.
Ans:
Locking and time stamp ordering are pessimistic in that they force a wait or a rollback when ever
a conflict is detected, even though there is a chance that the schedule may be conflict
serializable.
Example of Locking protocol:
Example of a transaction performing locking:
T2: lock-S(A);
read (A);
unlock(A);
lock-S(B);
read (B);
unlock(B);
display(A+B)
Locking as above is not sufficient to guarantee serializability — if A and B get updated inbetween the read of A and B, the displayed sum would be wrong.
A locking protocol is a set of rules followed by all transactions while requesting and releasing
locks. Locking protocols restrict the set of possible schedules.
29. What is the difference between REDO and UNDO operation.
Ans:
Transcation which began either before or after the last check point,but were COMMITED after
the checkpoint, prior to failure.These transcation need a REDO operation during recovery.
Transcation which began before or after the last checkpoint, but were still not commited at the
time of failure. These need UNDO operation at the time of recovery.
30. Define transaction. Explain different states of a transaction. Differentiate between chained
transaction and nested transaction. Discuss their advantaged and disadvantages.
Ans:
A transaction is a unit of program execution that accesses and possibly updates various data
items.
TRANSCATION STATE:
A transaction must be in one of the following states:
• Active, the initial state; the transaction stays in this state while it is executing
• Partially committed, after the final statement has been executed
• Failed, after the discovery that normal execution can no longer proceed
• Aborted, after the transaction has been rolled back and the database has been
restored to its state prior to the start of the transaction
• Committed, after successful completion
31. Define weak entity and cardinality ratio
Ans:
Weak entity:
Entity types that do not contain any key attribute, and hence can not be identified independently
are called weak entity types. A weak entity can be identified by uniquely only by considering
some of its attributes in conjunction with the primary key attribute of another entity, which is
called the identifying owner entity.
Cardianality Ratio(Mapping Cardinalities):
Mapping cardinalities or cardinality ratios, express the number of entities to which another entity
can be associated via a relationship set.
Mapping cardinalities are most useful in describing binary relationship sets, although they can
contribute to the description of relationship sets that involve more than two entity sets.
For a binary relationship set R between entity sets A and B, the mapping cardinalities must be
one of the following:
One-to-one,one-to-many,many-to-one,many-to-many
32. Consider the following three tables-sailors, reserves and boats having the follwing attributes.
Sailors (Salid,Salname,Rating,Age)
Reserves(Salid,Boatid,Day)
Boats(Boatid,boat_name,color)
Use the above schema and solve the queries in relational algebra
Find the name of the sailors who have reserve boat 103.
Ans:
reserves.boatid=103(Sailors X Reserves X Boats))
Find the name of the sailors who have reserved red color.
Ans:
Boats.color=”RED”(Sailors X Reserves X Boats))
Find the columns of boats reserved by Lubber.
Ans:
and Reserves.Boatid= Boats.boatid and
Sailors.salname=”Lubber”(Sailors X Reserves X Boats))
33. Consider the universal relation R={A,B,C,D,E,F,G,H,I,J} and set of functional dependencies.
F={ AB→C,A→DE,B→F,F→GH,D→IJ}
What is the key for R ? Decompose R into 2NF relations.
ans:
In relation R
(AB)+ = {A,B,C,D,E,F,G,H,I,J}
A+= {A,D,E,I,J}
B+= {B,F}
34. Expalin the data base recovery technique based on deferred update.
Ans:
To ensure atomicity despite failures, we first output information describing the modifications to
stable storage without modifying the database itself.
We study two approaches:
log-based recovery, and
shadow-paging
We assume (initially) that transactions run serially, that is, one after the other.
Two approaches using logs
Deferred database modification
Immediate database modification
Deferred Database Modification
The deferred database modification scheme records all modifications to the log, but defers all
the writes to after partial commit.
Assume that transactions execute serially
Transaction starts by writing <Ti start> record to log.
A write(X) operation results in a log record <Ti, X, V> being written, where V is the new value
for X
Note: old value is not needed for this scheme
The write is not performed on X at this time, but is deferred.
When Ti partially commits, <Ti commit> is written to the log
Finally, the log records are read and used to actually execute the previously deferred writes.
During recovery after a crash, a transaction needs to be redone if and only if both <Ti start>
and<Ti commit> are there in the log.
Redoing a transaction Ti ( redoTi) sets the value of all data items updated by the transaction to
the new values.
Crashes can occur while
the transaction is executing the original updates, or
while recovery action is being taken
example transactions T0 and T1 (T0 executes before T1):
T0:
read (A)
T1 : read (C)
A: - A - 50
C:-C- 100
Write (A)
write (C)
read (B)
B:- B + 50
write (B)

Below we show the log as it appears at three instances of time.
If log on stable storage at time of crash is as in case:
(a) No redo actions need to be taken
(b) redo(T0) must be performed since <T0 commit> is present
(c) redo(T0) must be performed followed by redo(T1) since
<T0 commit> and <Ti commit> are present
35. Describe the problems with the traditional two-tier client-server architecture and
discuss how these problems were overcome with the three-tier client-server architecture
In the mid-1990s, as applications became more complex and potentially could be deployed to
hundreds or thousands of end-users, the client side of this architecture gave rise to two problems:
A ‘fat’ client, requiring considerable resources on the client’s computer to run effectively
(resources include disk space, RAM, and CPU power).
A significant client side administration overhead.
By 1995, a new variation of the traditional two-tier client-server model appeared to solve these
problems called the three-tier client-server architecture. This new architecture proposed three
layers, each potentially running on a different platform:
The user interface layer, which runs on the end-user’s computer (the client).
The business logic and data processing layer. This middle tier runs on a server and is often
called the application server. One application server is designed to serve multiple clients.
A DBMS, which stores the data required by the middle tier. This tier may run on a separate
server called the database server.
The three-tier design has many advantages over the traditional two-tier design, such as:
A ‘thin’ client, which requires less expensive hardware.
Simplified application maintenance, as a result of centralizing the business logic for many endusers into a single application server. This eliminates the concerns of software distribution that
are problematic in the traditional two-tier client-server architecture.
Added modularity, which makes it easier to modify or replace one tier without affecting the other
tiers.
Easier load balancing, again as a result of separating the core business logic from the database
functions. For example, a Transaction Processing Monitor (TPM) can be used to reduce the
number of connections to the database server. (A TPM is a program that controls data transfer
between clients and servers in order to provide a consistent environment for Online Transaction
Processing (OLTP).)
An additional advantage is that the three-tier architecture maps quite naturally to the Web
environment, with a Web browser acting as the ‘thin’ client, and a Web server acting as the
application server.
36. What is QBE and what is the relationship between QBE and SQL?
QBE is an alternative, graphical-based, ‘point-and-click’ way of querying the database, which is
particularly suited for queries that are not too complex, and can be expressed in terms of a few
tables. QBE has acquired the reputation of being one of the easiest ways for non-technical users
to obtain information from the database.
QBE queries are converted into their equivalent SQL statements before transmission to the
DBMS server.