Assignment - I
Assignment - I
useful.
Give an expression in the relational algebra, the tuple relational calculus, and
the
Find the names of all employees who work for estate bank. [16]
i. join operation
iii. Display customernames in alphabetical order who have a loan at the Perry
iv. Find set of all customers who have an account at the bank?
5. (a) Explain the distinction among the terms primary key, candidates key and
super key.
(c) What are the differences between the two types of relational calculus?
i. Find the age of the youngest sailor for each rating level?
ii. Find the age of the youngest sailor who is eligible to vote for each rating
iv. Find the average age of sailor for each rating level that at least 2 sailors.
8. a) Why would choose a database system instead of simply storing data in oper-
ating system files ? When would it make sense not to use a database system?
b) What are the SQL constructs to modify the structure of tables, views and to
b) For the following relational database, give the expressions in SQL. branch
schema
(branch name, branch city, assets) customer schema (customer name, cus-
tomer street, customer city) Loan schema (branch name, loan number,
amount)
i. find the names of all customers whos street address include substring
’Main’
ii. Find average balance for each customer who lives in Harrison and at least
three accounts?
iii. . Find all customer who have a loan at bank whose names are neither
Transaction (transno,acctno,date,amount)
The amount attribute values is positive for deposits and negative for
withdrawals.
(acctno,T1.date,T2.amouont)
For every pair of transactions T1,T2 such that T1 and T2 are transaction on
the same account and the date of T2 is <=the date of T1.
b) Using only the above view TP, write a querry to find for each account the
minimum balance it ever reached (not including the 0 balance wen the
account is created). Assume there is at most one transaction per day on each
account and each account has had atleast one transaction since it was
created. To simplify your query break it up into 2 steps by defining an
intermediate view V.
12. You need to create a database to store information about U.S. ski areas. You
wish to be
able to look up their regular full day lift-ticket price, total square acres of terrain,
and
vertical feet. At some ski areas, purchasing a lift-ticket gives the ticket-holder the
right
to ski at other partner ski areas as well, and you wish to store that information in
your
database. For each ski area, you also want to be able to access some basic
statistics
about the mountain(s) on which the area is located (specifically, height and average
snowfall).
Draw an E-R diagram for this database, following the notation in this course. Your
diagram should show entities, relationships, and attributes, and should include 1:1,
1:M,
M:M labels. Also denote any mandatory relationships and weak entities in your
model.
13. Consider the following relational database schemas:
COURSES(cno,name)
PRE-REQ(cno,pre-cno)
COMPLETED(studentno,cno)
COURSES gives the number and name of all the vailable courses.
PRE-REQ gives the information about which courses are pre-requisites for
given course.
List all the courses for which a student with student no 2310 has completed
all the pre-requisites.
INTERVIEW(cname,sno,idate) OFFER(cname,sno,osal)
The company relation gives the name and location of the company. The
STUDENT relation gives the student’s rno,name and the degree program for
which the student is registered in the university. The INTERVIEW relation
gives the date on which a student is interviewed by a company. The OFFER
relation gives the salary offered to a student who is successful in a
company’s interview. The key for each relation is indicated by the underlined
attributes.
2) List the rnos and names of students who went for interviews and received
job offers from every company with which they interviewed.
b) Write an SQL query to list, for each degree program in which more than five
students were offered jobs, the name of the degree and the average offered
salary of students in this degree program.
15. a) Explain the structure of DBMS. b) Explain the life cycle of DBMS.