2) Tuple Relational Calculus Queries Consider the \"Hiking\" database schema sho
ID: 3730555 • Letter: 2
Question
2) Tuple Relational Calculus Queries Consider the "Hiking" database schema shown below. The HIKES relation indicates the mountains hiked by each hiker. The INHABITS relation shows what animals inhabit each mountain and the EATS relation indicates which animals each hiker eats. Express each of the following queries using tuple relational calculus. 2.1) Print the mountains that are inhabited by an animal that hiker Scott eats. 2.2) Print the hikers that hike at least one mountain that is inhabited by an animal they eat. 2.3) Print the hikers that hike no mountain that is inhabited by an animal that they eat. Hiking Schema HIKES(hiker,mountain) INHABITS(animal,mountain) EATS(hiker,animalExplanation / Answer
2.1 {P | IINHABITS EEATS (I.animal = E.animal E.hiker = 'Scott' P.mountain = I.mountain)}
2.2 {P | HHIKERS IINHABITS EEATS (I.animal = E.animal I.mountain = H.mountain E.hiker = H.hiker P.hiker = H.hiker)}
2.3 {P | HHIKERS IINHABITS EEATS (E.animal = I.animal I.mountain H.mountain E.hiker = H.hiker P.hiker = H.hiker)}
//explanation
A tuple relational calculus query has the form {T | p(T) }, where T is a tuple variable and p(T) is a formula that describes T.
The result of this query is the set of all tuples t for which the formula p(T) evaluates to true with T = t
The quantifier binds the variable that is followed by the quantifier.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.