0% found this document useful (0 votes)
99 views2 pages

DB Relational

The document provides relational algebra expressions for 6 queries over sample schemas. Query 1 finds red part names, Query 2 finds prices for red or green parts, Query 3 finds suppliers of red or green parts, Query 4 finds supplier names for red or green parts, and Query 5 is not possible since a part can only have one color. Query 6 finds appointment times and client names for staff member Giuliano on Feb 14.

Uploaded by

Nathnael Mesfin
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)
99 views2 pages

DB Relational

The document provides relational algebra expressions for 6 queries over sample schemas. Query 1 finds red part names, Query 2 finds prices for red or green parts, Query 3 finds suppliers of red or green parts, Query 4 finds supplier names for red or green parts, and Query 5 is not possible since a part can only have one color. Query 6 finds appointment times and client names for staff member Giuliano on Feb 14.

Uploaded by

Nathnael Mesfin
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/ 2

American College of Technology

Database Assignment
Write relational algebra expression for the following queries

Use the following schema for question 1-5

Suppliers(sID, sName, address)

Parts(pID, pName, colour)

Catalog(sID, pID, price)

1. Find the names of all red parts


 ΠpName(σcolour = “red”Parts)
2. Find all prices for parts that are red or green. (A part may have different
prices from different manufacturers.)
 Πprice((σcolour = “red” V colour = “green” Parts)⨝
Catalog)
3. Find the sIDs of all suppliers who supply a part that is red or green.
 πsid ((σcolor= “red” V color= “green” Parts ) ⨝Catalog )
4. Find the names of all suppliers who supply a part that is red or green.
 ΠsName((ΠsID((σcolour = “red”V colour = “green” Parts)
⨝Catalog)) ⨝Suppliers)
5. Find the sIDs of all suppliers who supply a part that is red and green.
 Each tuple has only one colour, and each part has only one tuple
(since pID is a key), so no part can be recorded as both red and green.

Use the following schema for question 6

Clients(cID, name, phone)

Staff(sID, name)

Appointments(cID, date, time, service, sID)


6. Find the appointment time and client name of all appointments for staff
member Giuliano on Feb14. (assume that = can be used also to compare
date)
 Πname,time((ΠCID,SID,timeσdate=“Feb14”Appointments) ⨝
(ΠSIDσname=“Giuliano”Staff) ⨝ Clients)

Group Members
1. Hasset Markos
2. Meklit Dagmawi
3. Nathnael Mesfin

You might also like