

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Relational Algebra, Relational Calculus, Datalog Past Midterm problems
(b) Write a Datalog query that returns all neighbors who do not have any colleagues in common. Solution : NonAnswers(n1, n2):-ยญโ Neighbors(n1, n2, -ยญโ), Colleagues(n1, c, -ยญโ), Colleagues(n2, c, -ยญโ) A(n1, n2):-ยญโ Neighbors(n1, n2, -ยญโ), NOT NonAnswer(n1,n2) (c) Indicate if the following relational calculus queries are correct or not (true or false). Note: This is not meant to be a tricky question. Errors, if any, should be reasonably obvious. You do NOT need to correct wrong queries: