Tests 22 Sem 1
Tests 22 Sem 1
Tests 22 Sem 1
The relation webpage stores data about web pages. Each web page is described by a
unique identifier webID, a title webTitle, its url, and the number of hits to it. The
relation courseware contains data about the course material of a course. Each
courseware record stores a unique identifier cID to identify a courseware file, a
description cDescription of the courseware file, a directory ftplocation from where
the file can be downloaded, and the category of courseware (‘P’ = publication, ‘N’ =
notes, ‘D’ = document, ‘E’ = executable). The relation ftpLink stores for each Web
page the ftp links to multiple courseware files and for each courseware file the
different Web pages to which it is linked.
The key fields are underlined, and the domain of each field is listed after the field
name. Therefore sid is the key for Suppliers, pid is the key for Parts, and sid and pid
together form the key for Catalog. The Catalog relation lists the prices charged for
parts by Suppliers. Write the following queries in relational algebra:
i. Find the names of suppliers who supply some red part. [2]
ii. Find the sids of suppliers who supply some red or green part. [2]
iii. Find the sids of suppliers who supply some red part or are at 221 Packer
Street. [2]
i. Create a view called “orders” that has the total cost of every order. [3]
ii. List the names of customers who have ordered items weighing more than 1000.
[3]
iii. List the names of customers who have ordered at least one item priced over $500.
[3]