Relational-Calculus

 Question 1
Let R and S be relational schemes such that R={a,b,c} and S={c}. Now consider the following queries on the database: Which of the above queries are equivalent?
 A I and II B I and III C II and IV D III and IV
Database-Management-System       Relational-Calculus       2009
Question 1 Explanation:
R={a,b,c}
S={c}

It looks like Division operator. Since a division operator in E(A,B)/ P(B) will be equal to

Now replacing A=R-S P=r
B=S
E=r
we will get,

equivalent to I
∴ It is equivalent to division operator.
⇒ r(R-S,S)/r(S)

This logical statement means that
① Select t(R-S) from r such that
② for all tuples U in S,
③ there exists a tuple V in r, such that
④ U=V[S] & t=V[R-S]
A(x,y) & B(y)
A/B = {(x) | ∃(x,y)∈A(y)∈B}
which means that A/B contains all x tuples, such that for every tuple in B, there is an xy tuple in A.
So, this is just equivalent to I.

This logical statement means that
① Select t(R-S) from r such that
② for all tuples V in r,
③ there exists a tuple U in r, such that
④ U=V[S] & t=V[R-S]
⇒ Select (R-S) values from r, where the S value is in (r/r), which will be true only if S in r is a foreign key referring to S is r.

This selects (a,b) from all tuples from r which has an equivalent value in S.
 Question 2
Which of the following tuple relational calculus expression(s) is/are equivalent to
 A I only B II only C III only D III and IV only
Database-Management-System       Relational-Calculus       Gate-2008
Question 2 Explanation:
Demorgan law:
∀xP(x)≡∼∃x(∼P(x))
∼∀x(∼P(x))≡∃x(P(x))
Given: ∀t ∈ r(P(t))------ (1)
As per Demorgan law
(1) ⇒ ∼∃t ∈ r(∼P(t))
which is option (III).
 Question 3
Student (school-id, sch-roll-no, sname, saddress) School (school-id, sch-name, sch-address, sch-phone) Enrolment(school-id sch-roll-no, erollno, examname) ExamResult(erollno, examname, marks) What does the following SQL query output?
 `SELECT  sch-name, COUNT (*)` `FROM    School C, Enrolment E, ExamResult R` `WHERE   E.school-id = C.school-id` `AND` `E.examname = R.examname AND E.erollno = R.erollno` `AND` `R.marks = 100 AND S.school-id IN (SELECT school-id` `                                ``FROM student` `                                ``GROUP BY school-id` `                                 ``HAVING COUNT (*) > 200)` `GROUP By school-id` ` ``/* Add code here. Remove these lines if not writing code */`
 A The empty set B schools with more than 35% of its students enrolled in some exam or the other C schools with a pass percentage above 35% over all exams taken together D schools with a pass percentage above 35% over each exam
Database-Management-System       Relational-Calculus       Gate 2008-IT
Question 3 Explanation:
Query having the division with
{ x | x ∈ Enrolment ∧ x . school-id = t } | * 100 > 35 }
This is school with enrollment % is 35 or above.
 Question 4
Consider the relation employee(name, sex, supervisorName) with name as the key. supervisorName gives the name of the supervisor of the employee under consideration. What does the following Tuple Relational Calculus query produce?
 A Names of employees with a male supervisor. B Names of employees with no immediate male subordinates. C Names of employees with no immediate female subordinates. D Names of employees with a female supervisor.
Database-Management-System       Relational-Calculus       Gate-2007
Question 4 Explanation:
The given Tuple Relational calculus produce names of employees with no immediate female subordinates.
 Question 5
Which of the following relational calculus expressions is not safe?
 A {t|∃u ∈ R1 (t[A] = u[A])∧ ¬∃s ∈ R2 (t[A] = s[A])} B {t|∀u ∈ R1 (u[A]= "x" ⇒ ∃s ∈ R2 (t[A] = s[A] ∧ s[A] = u[A]))} C {t|¬(t ∈ R1)} D {t|∃u ∈ R1 (t[A] = u[A])∧ ∃s ∈ R2 (t[A] = s[A])}
Database-Management-System       Relational-Calculus       Gate-2001
There are 5 questions to complete.
PHP Code Snippets Powered By : XYZScripts.com