DB Lab 1
DB Lab 1
DATA
BASE
Db lab
Assignment no 1
Instructor: Sadia Maryam
Date: 29th Sep 2024
QUESTION # 1:
Q1: Write Relational algebra expressions for the following information needs
over Database Systems the Complete Book -Exercise 2.4.1(Note: you can use
similar queries from the given quires
a) Πmodel(σmodel>1000∧hd>250(PC))
b) Πmaker, model, type, speed, ram, price(σyear>2000∧price>1000∧speed>1.5
(Laptop⋈Product))
c) Πmaker, model, ram, hd, price(σmodel>1000∧hd>250∧maker=′B′
(PC⋈Product))
d) speed(PC)∪Πspeed(Laptop)
e) ΠLaptop.model(σLaptop.speed=PC.speed(Laptop×PC))
f) Πmaker, model(σmodel>2005(Laptop⋈Product))
g) Πmodel, maker(σspeed>1.5(Product⋈(PC∪Laptop)))
h) Πmodel(σyear>2000∧speed>1.5∧type=′Laptop′(Laptop⋈Product))
i) γram,COUNT(model),AVG(speed)(PC)
Question 2:
- Write Relational algebra expressions for the following information
needs over University Database:
I. Retrieve the title of the course that is pre-req of 'Database System Concepts.’
II. Retrieve the semester and the year in which ‘Einstein’ taught the course
‘Physical Principles’.
III. Retrieve the ID and the title of all courses taken by ‘Shankar’ in ‘Fall 2009’.
IV. List the name of students who did not take any course in ‘Fall 2009’.
V. Find building, room number, and capacity of all classrooms in which student
‘Tanaka’ took all his classes.