Updated DBMS Question Bank Unit1-2
Updated DBMS Question Bank Unit1-2
Updated DBMS Question Bank Unit1-2
Subject: DBMS
UNIT – I & II QUESTION BANK
UNIT-I:
Question 1 : Suppose you are given the following requirements for a simple database for the
National Hockey League (NHL):
the NHL has many teams,
each team has a name, a city, a coach, a captain, and a set of players,
each player belongs to only one team,
each player has a name, a position (such as left wing or goalie), a skill level, and a set
of
injury records,
a team captain is also a player,
a game is played between two teams (referred to as host_team and guest_team) and has
a date (such as May 11th, 1999) and a score (such as 4 to 2).
Construct a clean and concise ER diagram for the NHL database
Question 2: (a) 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.
(b) Construct appropriate tables for the above ER
Diagram ? Car insurance tables:
person (driver-id, name,
address) car (license,
year,model)
accident (report-number, date, location)
participated(driver-id, license, report-number, damage-amount)
Question 4:
(a) 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
b) Construct an alternative E-R diagram that uses only a binary relationship between
students and course-offerings. Make sure that only one relationship exists between a
particular student and course-offering pair, yet you can represent the marks that a student
gets in different exams of a course offering.
Question 6: Design an E-R diagram for keeping track of the exploits of your favorite sports
team. You should store the matches played, the scores in each match, the players in each
match and individual player statistics for each match. Summary statistics should be modeled as
derived attributes.
Question 7 : Extend the E-R diagram of the previous question to track the same information
for all teams in a league.
Question 13 Construct the ER model for the given requirements of Banking application Saving_Account,
Loan_account, Branch, Depositor and Borrower
Question 14: Consider the following ER Diagram and minimize it into relations.
Solution:
Question 14: List four significant differences between a file-processing system and a DBMS
A database coordinates the physical and logical access to the data; a fileprocessing
system only coordinates physical access to the data
A DBMS reduces the amount of data duplication
A DBMS is designed to allow flexibility in what queries give access to the data, where a
file-processing system only allows pre-determined access to data (by specific compiled
programs)
A DBMS is designed to coordinate and permit multiple users to access data at the
same time. A file processing system is much more restrictive in simultaneous data
access
Question 15: What are the major disadvantages of a database system.
Setup of the database system requires much more knowledge, money, skills, and time
Complexity of the database may result in poor performance
.
Question 16: Explain the distinctions among the terms primary key, candidate key, and
superkey
A superkey is any set of attributes such that the values of the attributes (taken
together) uniquely identify one entity in the entity set.
A candidate key is a minimal superkey — a superkey with no redundant attributes. In
other words, if any one of the attributes is removed, the set of attributes that remain no
longer form a superkey.
A primary key is one of the candidate keys, designated by the database designer.
Every primary key is also a candidate key; every candidate key is also a superkey, but not
vice versa.
A superkey is a set of one or more attributes that, taken collectively, allows us to identify
uniquely an entity in the entity set. A superkey may contain extraneous attributes. If K is a
superkey, then so is also a superkey is called a candidate key. It is possible that several distinct
sets of attributes could serve as candidate keys. The primary key is one of the candidate keys
that is chosen by the database designer as the principal means of identifying entities within an
entity set.
Question 17: Explain the difference between a weak and a strong entity set.
A strong entity set has a primary key. All tuples in the set are distinguishable by that key. A
weak entity set has no primary key unless attributes of the strong entity set on which it
depends are included. Tuples in a weak entity set are partitioned according to their relationship
with tuples in a strong entity set. Tuples within each partition are distinguishable by a
discriminator, which is a set of attributes.
Question 18: 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
Question 9 Write the PL/SQL block code to display diameter, circumference and area of the circle for
given radius=9.5
Question 10 Write the PL/SQL block code to fetch customer details from the given customer table and
display on the screen whose customer id is „C1‟
Question 11 Write a PL/SQL function for following requirements and the same in PL/SQL block:
Account no. and branch name will be accepted from user. The same will be searched in table
acct_details. If details are available in table display message as “Account is active”, otherwise
display message on screen “account is inactive
Question 12 Write a PL/SQL block for following requirement using user defined exception
handling.
The account_master table records the current balance for an account, which is updated whenever,
any deposits or withdrawals takes place. If the withdrawal attempted is more than the current
balance held in the account. The user defined exception is raised, displaying an appropriate
message. Write a PL/SQL block for above requirement using user defined exception handling.
Question 13. Write the PL/SQL block code to find reverse of a number using for loop.