0% found this document useful (0 votes)
14 views3 pages

DBMS - Qb-Unit 2

The document contains a question bank for Unit 2, focusing on relational databases and relational algebra. It includes theoretical questions defining key concepts, as well as practical queries to be solved using relational algebra on various database schemas. The queries cover operations such as selection, projection, joins, and constraints, along with examples from different database contexts.

Uploaded by

Surya Anand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

DBMS - Qb-Unit 2

The document contains a question bank for Unit 2, focusing on relational databases and relational algebra. It includes theoretical questions defining key concepts, as well as practical queries to be solved using relational algebra on various database schemas. The queries cover operations such as selection, projection, joins, and constraints, along with examples from different database contexts.

Uploaded by

Surya Anand
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Question Bank

UNIT 2
A. Theory Questions

1 Define the following: i)Relation ii)Domain iii)Tuple iv)Primary key v)Foreign


key

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

B. Solve below queries in Relational Algebra

1 SAILORS( sid, sname, rating, age)


BOATS(bid, bname,color)
RESERVES(sid,bid,day)
1. Find the sids of sailors with age over 20 who have not reserved a red boat.
2. Find the name of the sailors, who have reserved at least two boats.
3. Find the names of sailors who have reserved a red or a green boat.
4. F i n d the colors of boats reserved by “Rajesh”.
5. Find the name of the sailors who have reserved boat 103.
6. Find the sailors with the highest rating
7. Find the average age of all sailors
8. Find the average age of sailors with a rating of 10
9. Find the name and age of the oldest sailor
10. Count the number of sailors
11. Find the age of the youngest sailor for each rating level
2 Specify the following queries on the Flight relational database schema using
relational algebra

1.Find the eids of pilots certified for some Boeing aircraft.


2. Find the names of pilots certified for some Boeing aircraft.
3. Find the aids of all aircraft that can be used on non-stop flights from Bonn to
Madras.
4. Identify the flights that can be piloted by every pilot whose salary is more than
$100,000.
5. Find the names of pilots who can operate planes with a range greater than 3,000
miles but are not certified on any Boeing aircraft.
6. Find the eids of employees who make the highest salary.
7. Find the eids of employees who make the second highest salary.
8. Find the eids of employees who are certified for the largest number of aircraft.
9. Find the eids of employees who are certified for exactly three aircraft.
10. Find the total amount paid to employees as salaries

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.

You might also like