DBMS QP1
DBMS QP1
Q. No.
Module-I Marks CO BL
Explain the three-schema architecture with a neat diagram. Why do we 10 CO1 L2
1. (a)
need mappings between schema levels?
Design an ER diagram for an insurance company. Assume suitable entity 10 CO3 L4
1. (b) types like CUSTOMER, AGENT, BRANCH, POLICY, PAYEMENT and the
relationship between them.
Module-II
Explain the various restrictions on data that can be specified on a 10 CO1 L2
2.(a)
relational database in the form of constraints.
Consider the following schema for COMPANY database 10 CO2 L3
EMPLOYEE (Fname, Lname, Ssn, Address, Bdate,Super-ssn, Salary, Dno)
DEPARTMENT (Dname, Dnumber, Mgr-ssn, Mgr-start-date)
DEPT-LOCATIONS (Dnumber, Dlocation)
PROJECT (Pname, Pnumber, Plocation, Dnum)
WORKS-ON (Essn, Pno, Hours)
DEPENDENT (Essn, Dependent-name, Sex, Bdate, Relationship)
Develop the queries in relational algebra for the following
i) Retrieve the birth date and address of the employee(s) whose
2.(b)
name is ‘John B.Smith’.
ii) Retrieve the name and address of all employees who work for the
‘Research’ department.
iii) Find the names of employees who work on all the projects
controlled by department number 5.
iv) Retrieve a list of names of each female employee’s dependents.
v) For every project located in ‘Stafford’, list the project number, the
controlling department number and the department managers last
name, address and birth date
Module-III
Consider the following schema 10 CO2 L3
Sailors(sid,sname,rating,age)
Boats(bid,bname,color)
3.(a)
Reserves(sid,bid,day)
write the SQL query for the following:
i) Retrieve the sailors name who have reserved red and green boats.
1
Course Code: 21CS/IS43
ii) Retrieve the sailors names with age over 20 years and reserved black
boat.
iii) Retrieve the number of boats which are not reserved.
iv) Retrieve the sailors names who have reserved green boat on Monday.
v) Retrieve the sailors names who is oldest sailor with rating 10.
Consider the bank database with the following tables 10 CO2 L3
Branch(branch_name,branch_city,assets)
Customer(customer_name,customer_city)
Account(account_number,branch_name,balance)
Loan(loan_number,branch_name,amount)
3.(b) Depositor(customer_name,account_number)
Borrower(customer_name, loan_number)
Write an assertion to
i) Specify the constraint that the Sum of loans taken by a customer does
not exceed 100,000.
ii) Specify the constraint that the Number of accounts for each customer
in a given branch is at most two
OR
Consider the following tables: 10 CO2 L3
Works(Pname,Cname,Salary)
Lives(Pname,Street,City)
Located-in(Cname,City)
Manager(Pname,mgrname)
Write the SQL query for the following:
4.(a) i) Find the names of all persons who live in the city ‘Mumbai’
ii) Retrieve the names of all person of ‘Infosys’ whose salary is between
Rs.30,000 and Rs.50,000.
iii) Find the names of all persons who live and work in the same city.
iv) List the names of the people who work for ‘Wipro’ along with the
cities they live in.
v) Find the average salary of all ‘Infosyians’
Consider the Employee table with the attributes Emp_name, Department, 10 CO2 L3
Salary, Bonus, Rank. Write a trigger to perform the following operations
i) If the employee salary increased by more than 10%, then
4.(b)
increment the rank field by 1.
ii) Keep the bonus attribute in Employee table always 3% of the salary
attribute
Module- IV
Illustrate insertion, deletion and modification anomalies by considering 5 CO2 L3
the following schema diagram.
5.(a)
Consider the relation schema LOTS which describes parcels of land for sale 8 CO3 L4
5.(b) in various counties of a state. Suppose that there are two candidate keys:
Property_id# and {County_name, Lot#}; that is, lot numbers are unique
only within each county, but Property_id# numbers are unique across
2
Course Code: 21CS/IS43
counties for the entire state. Based on the two candidate keys Property_id#
and {County_name, Lot#}, the functional dependencies FD1 and FD2 hold
1. FD1: Property_id → { County_name,Lot#,Area,Price,Tax_rate}
2. FD2:{County_name,Lot#} →{Property_id, Area,Price,Tax_rate}
3. FD3: County_name → Tax_rate
4. FD4: Area → Price
Design a relational schema for this database application that are each in
2NF and 3NF.
Suppose that EMP_PROJ relation is represented as follows: 7 CO3 L4
EMP_PROJ(Ssn, Ename, {PROJS(Pnumber, Hours)})
Ssn is the primary key of the EMP_PROJ relation and Pnumber is the partial
5.(c)
key of the nested relation; that is, within each tuple, the nested relation
must have unique values of Pnumber
Design a normalized relational schema that are each in 1NF and 2NF
OR
Consider the following relation for published books: 5 CO2 L3
BOOK(BookTitle, AuthorName, BookType, ListPrice, AuthorAffiliation,
Publisher)
Suppose the following dependencies exist:
BookTitle → BookType, Publisher
6.(a) BookType → ListPrice
AuthorName → AuthorAffiliation
I) Based on the given primary key, is the relation in 1NF, 2NF? Why or
why not?
II) Apply normalization to successively normalize it till 3NF.
Consider the EMP relation. A tuple in this EMP relation represents the fact 8 CO3 L4
that an employee whose name is Ename works on the project whose name
is Pname and has a dependent whose name is Dname. An employee may
work on several projects and may have several dependents. The
employee’s projects and dependents are independent of one another.
Sample data for an employee Smith having two dependents and working
on two projects X & Y is shown in fig 6(b)
6.(b)
Fig:6(b)
3
Course Code: 21CS/IS43
7. (a) Explain the need for concurrency control in transaction processing. 10 CO1 L2
7.(b) Illustrate with an example how Two-Phase locking can be used to 10 CO2 L3
guarantee serializability.