0% found this document useful (0 votes)
4 views

assignment 2

This document outlines an assignment for the Database Management System course at SRM Institute of Science and Technology for the academic year 2024-25. It includes various relational algebra queries related to employee, bank, and university databases, requiring students to express specific queries using relational algebra. The assignment is structured with multiple questions, each focusing on different aspects of database queries and operations.

Uploaded by

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

assignment 2

This document outlines an assignment for the Database Management System course at SRM Institute of Science and Technology for the academic year 2024-25. It includes various relational algebra queries related to employee, bank, and university databases, requiring students to express specific queries using relational algebra. The assignment is structured with multiple questions, each focusing on different aspects of database queries and operations.

Uploaded by

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

RAMAPURAM SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

SCHOOL OF COMPUTER SCIENCE AND ENGINEERING


OSRM
DSnTLO KINCTA TLOGY FACULTY OF ENGINEERING AND TECHNOLOGY
TUV
SUD

RAMAPURAM, CHENNAI - 89

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


ACADEMICYEAR 2024-25 EVEN SEMESTER

ASSIGNMENT-2
SUBJECT CODE/SUBJECT NAME: 21CSC205P/Database Management System
YEAR/SEM/DEPT: IIYear/4h SemB.Tech - CSE,
CSE with Specialization in AIML,BDA,CC,IOT,CS,GT
Submission Date: 11/4/25
QNo. Questions Marks CO BL PI

1 Consider the relational database given. Give an


expression in the relational algebra to express each of
the following queries:
employee (person name, street, city)
works (person name, company name, salary)
company (company name, city) 2 CO3 2 2.6.3
a. Find the names of all employees who live in city
"Miami".
b. Find the names of all employees whose salary is
greater than $100,000.
c. Find the names of all employees who live in
"Miami" and whose salary is greater than $100,000.
2 Consider the bank database. Give the expression in
the relational algebra for each of the following
queries.
branch(branch name, branch city,assets)
customer (customer name, customer street, customer
city)
loan (loan number, branch name, amount)
borrower (customer name, loan number) 2 CO3 2.6.3
account (account number, branch name, balance)
depositor (customer name, account number)
a. Findthe names of all branches located in
"Chicago".
b. Find the names of all borrowers who have a loan in
branch "Downtown".
c. Find the sum of loan amount sanctioned from the
branch "Chicago
3 Consider the relational database. Give an expression
in the relational algebra to express each of the
following queries:
employee (person name, street, city) CO3 22.6.3
works (person name, company name, salary)
company (company name, city)
a. Find the names of all employees who work for
First Bank Corporation".
b. Find the names and cities of residence of all
employees who work for "First Bank Corporation".
c. Find the names, street address,and cities of
residence of all employees who work for First Bank
Corporation" and earn more than $10,000.
4 Consider the bank database. Give an expression in the
relational algebra for each of the following queries:
branch(branch name, branch city, assets)
customer (customer name, customer street, customer
city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
account (account number, branch name, balance)
depositor (customer name, account number) 2 CO3 1 2.6.3
a. Find all loan numbers with a loan value greater than
$10,000.
b. Find the names of all depositors who have an
account with a value greater than $6,000.
c. Find the names of all depositors who have an
account with a value greater than $6,000 at the
"Uptown" branch.

Write the following queries in Relational algebra,


using the university schema.
department(dept_name, building, budget)
course(course_ id, title, dept name, credits)
instructor(|D, name, dept_name, salary)
section(course_ id, sec_ id,
semester,year,building,room number, time slot id) 2 CO3 2.6.3
teaches(ID,course id, sec id,semester,year)
a. Find the titles of courses in the Comp. Sci.
department that have 3 credits.
b. Find the IDs of all students who were taught by an
instructor named Einstein; make sure there are no
duplicates in the result.
c. Find the highest salary of any instructor
6 Write the following queries in Relational algebra,
using the university schema.
department(dept_ name, building, budget)
course(course id, title, dept name, credits)
instructor([D, name, dept name, salary)
section(course_ id, sec id,
semester,year,building,room_number, time slot id) 2 CO3 2.6.3
teaches([D,course id, sec id,semester,year)
a. Find all instructors earning the highest salary (there
may be more than one with the samne salary).
b. Find the enrolment of each section that was offered
in Autumn 2009.
c. Find the lowest salary of any instructor.
7
Write the following queries in Relational algebra 2 CO3 2.6.3
using the university schema.
department(dept_name, building, budget)
course(course_ id, title, dept name, credits)
instructor(|D, name, dept_namne, salary)
section(course id, sec id,
semester,year, building,room number, time slot id)
teaches(ID,course id, sec_ id,semester,year)
a. Find the maximum enrolment, across all sections, in
Autumn 2009.
b. Find the sections that had the maximum enrolment
in Autumn 2009.
c. Find the highest salary of any instructor.
Consider the bank database. Construct the following
Relational algebra queries for this relational database.
branch(branch name, branch city, assets)
customer (customer name, customer street, customer
city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
account (account number, branch name, balance)
2 CO3 2.6.3
depositor (customer name, account number)
a. Find all customers who have an account at all the
branches located in "Brooklyn".
b. Find out the total sum of all loan amounts in the
bank.
c. Find the names of all branches that have assets
greater than those of at least one branch located in
Brooklyn".
Consider the employee database. Give an expression
inRelational Algebra for each of the following
queries.
employee (employee name, street, city)
works (employee name, company name, salary)
company (company name, city)
manages (employee name, manager name)
a. Find the names and cities of residence of all 2 CO3 1 2.6.3
employees who work for First Bank
Corporation".
b. Find the names, street addresses, and cities of
residence of all employees who work for First
Bank Corporation and earn more than
$10,000.
Find all employees in the database who do not work
for "First Bank Corporation".
10 Consider the employee database. Give the Relational
Algebra expression for each of the following queries.
employee (employee name, street, city)
works (employee name, company name, salary)
company (company name, city) 2
manages (employee name, manager name) CO3 2 2.6.3
a. Find all employees in the database who earn
more than each employee of "Small Bank
Corporation".
b. Assume that the companies may be located in
several cities. Find all companies located in
every city in which "Small Bank Corporation"
is located.
C. Find the company that has the most
employees.
11 Consider the employee database. Give Relational
Algebra exxpression for each of the following queries.
employee (employee name, street, city)
works (employee name, company name, salary)
company (company name, city)
manages (employee name, manager name)
a. Find the company that has the most
2 CO3 22.6.3
employees.
b. Find those companies whose employees
earn a
higher salary, on average, than the average
salary at First Bank Corporation".
C. Find the names and cities of residence of all
employees who work for First Bank
12
Corporation".
Write the following queries in Relational algebra
using the university schema.
student (student-id, name, program)
department(dept_name, building, budget)
course(course id, title, dept name, credits)
instructor(|D, name, dept name, salary)
section(course id, sec id,
semester,year,building,roomnumber, time slot id)
teaches(D,course id, sec id,semester,year) CO3 2.6.3
a. Find the names of all students who have taken at
least one Comp. Sci. course, make sure there are no
duplicate names in the result.
b. Find the IDs and names of all students who have
not taken any course offering before Spring 2009.
c. For each department, find the maximum salary of
instructors in that department. You may assume that
every department has at least one instructor.
13 Write the following queries in Relational algebra,
using the university schema.
student (student-id, name, program)
department(dept_name, building, budget)
course(course_ id, title, dept name, credits)
instructor(|D, name, dept name, salary)
section(course id, sec id,
semester,year,building,room_ number, time slot id) 2 CO3 12.6.3
teaches(ID,course id, sec id,semester,year)
a. For each department, find the maximum salary
of instructors in that department. You may
assume that every department has at least one
instructor.
Find the lowest, across all departments, of the per
department maximum salary computed by the
preceding
query.
14 Consider the insurance database. Construct the CO3 1 2.6.3
following Relational Algebra queries for this
relational database.
person (driver id, name, address)
car (license, model, year)
accident (report number, date, location)
owns (driver id, license)
participated (report number, license, driver id, damage
amount)
a. Find the number of accidents in which the cars
belonging to "John Smith" were involved.
b. Find the car with the license number AABB2000
in the accident with report numberAR2197" to
$3000.
15 Consider the bank database. Construct the following
Relational algebra queries for this relational database.
branch(branch name, branch city, assets)
customer (customer name, customer street, customer
city)
loan (loan number, branch name, amount)
borrower (customer name, loan number)
account (account number, branch name, balance) 2 CO3 2.6.3
depositor (customer name, account number)
a. Find all customers of the bank who have an account
but not a loan.
b. Find the names of all customers who live on the
same street and in the same city as "Smith".
c. Find the names of all branches with customers who
have an account in the bank and who live in
Harrison".

16 Consider the employee database. Give Relational


Algebra expression for each of the following queries.
employee (employee name, street, city)
works (employee name, company name, salary)
company (company name, city)
manages (employee name, manager name)
live in 1 2.6.3
a. Find all employees in the database who 2 CO3
streets as do
the same cities and on the same
their managers.
the
b. Find all employees who earn more than
average salary of allemployees of their
company.
smallest
c. Find the company that has the
payroll.
Consider the bank database. Construct
the following
17
relational database.
Relational algebra queries for this
branch (branch name, branch city, assets)
street,
customer (customer name, customer
customer city) 2 CO3 1. 2.6.3
branch name, balance)
account (account number,
amount)
loan (loannumber, branch name,
number)
depositor (customer name, account
number)
borrower (customer name, loan
customers who have a
a. Find the names of all
from the bank
loan, an account, or both,
havea
allcustomers who
b. Find the names of
branch.
loan at the Perryridgecustomers who have a
names of all
c. Find the
branch but do not have
loan at the Perryridge bank.
branch of the
an account at any
Construct the following
18 Consider the bank database.
Relational algebra queries for
this relational database.
assets)
branch (branch name, branch city, street,
customer
customer (customer name,
customer city)
name, balance)
account (account number, branch
amount)
loan (loan number, branch name,
number)
depositor (customer name, account 2 CO3 22.6.3
borrower (customer name, loan number)

a. Find the largest account balance


b. Find the name of all customers who havea
loan at the bank and the loan amount
c. Find the names of all customers who have a
loan and an account at bank.

19 Consider the bank database. Construct the following


Relational algebra queries for this relational database.
name, branchcity, assets)
branch (branch
customer (customer name, customer street,
customer city)
account (account number, branch name, balance)
loan (loan number, branch name, amount)
depositor (customer name, account number) 2 CO3 22.6.3
borrower (customer name, loan number)
a. Find allcustomers who have an account from
at least the "Downtown" and the Uptown"
branches.
b. Find all customers who have an account at all
branches located in Brooklyn city.
c. Find the smallest account balance

20 Consider the bank database. Construct the following


Relational algebra queries for this relational database.
member(memb no, name, age)
book(isbn, title, authors, publisher)
borrowed(memb no, isbn, date)
a.Find the names of members who have borrowed any CO3 1 2.6.3
book published by "McGraw-Hill".
b. Find the names of members who have borrowed all
books published by Mc Graw-Hill".
c. For each publisher, find the names of members who
have borrowved more than five books of that publisher.

Prepared b Course oordinator HOD/C`E

You might also like