DBMS - Qb-Unit 2
DBMS - Qb-Unit 2
UNIT 2
A. Theory Questions
2 Consider the Company database, Appraise the various schema based or explicit
constraints that can be applied to a relational model. How these constraints are
violated during insert, delete and update operations
3 Illustrate the relational algebra operations Division and Cartesian Product with
examples.
4 Illustrate various types of joins with suitable examples.
5 In database, we should avoid the usage of cross product. Justify the statement with
a solution supported with an operator and its types in relational algebra.
6 Illustrate with examples, UNION, DIFFERENCE and INTERSECTION
operations in relational algebra.
7. In relational model the operations Select, Project ,Division and Cartesian Product
are used to form queries. Explain each with suitable example.
8 Explain different relational algebra notations with an example
4 Solve the following queries on the Company relational database schema using the
relational algebra operators.
EMPLOYEE(name,ssn,salary,sex,superssn,address,dno)
DEPARTMENT(Dname,Dnumber,MGRSSN)
DEPT_LOCATIONS ( Dnumber, Dloc)
PROJECT(Pname, Pnumber,Plocation,Dnum) WORKS_ON(ESSN,PNO,Hours)
DEPENDENT(ESSN, DEPE_Name, Address,Relationship,sex)
I. Find the names of employees who work on all the projects controlled by
dept no 5.
II. Retrieve the name and address of all employees who work for the sports
department.
III. . For every project located in ‘Bangalore’, retrieve the project number,
department number, department manager’s name, address and salary.
IV. Retrieve the names of employees who do not have dependents.
V. Find the names of all employees who are directly supervised by ‘Ram’
7 . Consider the following schema for a Library Database:
BOOK (Book_id, Title, Publisher_Name, Pub_Year)
BOOK_AUTHORS (Book_id, Author_Name)
PUBLISHER (Name, Address, Phone)
BOOK_COPIES (Book_id, Branch_id, No-of_Copies)
BOOK_LENDING (Book_id, Branch_id, Card_No, Date_Out, Due_Date)
LIBRARY_BRANCH (Branch_id, Branch_Name, Address)
Write relational algebra queries for the following
1. Retrieve details of all books in the library – id, title, name of publisher, authors,
number of copies in each branch, etc.
2. Get the particulars of borrowers who have borrowed more than 3 books, but
from Jan 2017 to Jun 2017
3. Delete a book in BOOK table. Update the contents of other tables to reflect this
data manipulation operation.
4. Partition the BOOK table based on year of publication. Demonstrate its
working with a simple query.
5. Create a view of all books and its number of copies that are currently available
in the Library.
13 Specify the following queries on the COMPANY relational database schema using
Relational algebra.
Employee (ssn, name, salary, sex, super_ssn, address, dno)
Department (dname, dnumber,mgr_ssn)
Dept_Loc ( dnumber, dloc)
Project (pname, pnumber, plocation, dnum)
Works_On (essn, pno, hours)
Dependent (essn, depen_name, address, relationship, sex)
i) Retrieve the name and address of all employees who work for ‘HR’
department.
ii) Retrieve the name and address of all employees who have no dependents
iii) For every project located in ‘Stafford’, list the project number,
controlling
department number, department manager’s name and address.
iv) Retrieve the average salary of all female employees.
v) Retrieve names of employees who work on any of the projects that
‘John’ works.