Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given three SQLlite table schemas as follows: customer (name: string, credit: in

ID: 3763956 • Letter: G

Question

Given three SQLlite table schemas as follows:

customer (name: string, credit: integer)

allowance (no: string, type: string, minCredit: integer)

asker(cname: string, lno: string, due: date)

asker.cname and asker.lno are foreign keys referencing customer, respectively allowance , whose keys are name, respectively no (number)

Write the Queries in Relation Tuple Calculus (RTC) and Relational Algebra

1. Find pairs of names of customers who share the same allowance. Avoid listing a customer with himself (Tim, Tim) and avoid listing the same over and over (ex. (Tim, Jane) and (Jane, Tim) should be one)

2 Find the allowance numbers shared by every customer with a credit rating below 600.

Explanation / Answer

1)
Create view temp_1 as select cname,minCredit from asker.Ino = allowance.no;
Create view temp_2 as select cname,minCredit from asker.Ino = allowance.no;
select temp1.cname,temp2.cname from temp1,temp2 where temp1.minCredit = temp2.minCredit and temp1.cname != temp2.cname;

2)
select Ino from asker where Ino = no and minCredit < 600;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote