Relational Calculus in DBMS

Last Updated :
Discuss
Comments

Question 1

What is the fundamental structure of a Tuple Relational Calculus (TRC) query?

  • { t | P(t) } where t is a tuple and P(t) is a condition

  • SELECT t FROM P(t) WHERE condition

  • [P(t)] → {t} for all tuples t

  • {P(t) | t ∈ r} where r is a relation

Question 2

Let R(A, B, C) be a relation schema. Which of the following tuple relational calculus expressions finds the names of all attributes A where the corresponding B value is greater than '10'?

(GATE 2006 | MCQ | 1-Mark)

  • [Tex]\{ t \mid \exists r \in R (t[A] = r[A] \wedge r[B] > 10) \}[/Tex]

  • [Tex]\{ t \mid r \in R \wedge r[B] > 10 \wedge t[A] = r[A] \}[/Tex]

  • [Tex] \{ t \mid \exists r \in R (t[A] = r[A]) \wedge r[B] > 10 \}[/Tex]

  • [Tex]\{ t \mid \exists r \in R (t[A] = r[A] \wedge \exists r[B] > 10) \}[/Tex]

Question 3

Consider the relation R(A, B, C, D) and the tuple relational calculus expression:

[Tex]\{ t \mid \exists u \in R (t[A] = u[A] \wedge t[B] = u[B] \wedge \forall v \in R (v[A] \neq u[A] \vee v[B] \neq u[B] \vee v[C] \le u[C])) \}[/Tex]

If t outputs the schema (A, B), what does this query fetch?

(GATE 2019 | MCQ | 2-Mark)

  • The attributes A and B for tuples in R that have the minimum C value for each combination of A and B

  • The attributes A and B for tuples in R that have the maximum C value for each combination of A and B

  • All tuples from R where C is greater than all other C values in the entire relation

  • The attributes A and B for all tuples in R

Question 4

How would you write a TRC query to find customers who do NOT have an account at the bank?

  • {t | ¬∃ s ∈ depositor(t[customer-name] = s[customer-name])}

  • {t | ∀ s ∈ depositor(t[customer-name] ≠ s[customer-name])}

  • {t | ∃ s ∈ depositor(¬t[customer-name] = s[customer-name])}

  • {t | depositor(t) ∧ ¬t[account-number]}

Question 5

Given relations R(A, B) and S(B, C), the relational algebra expression [Tex]\pi_A(R \bowtie S)[/Tex] is equivalent to which of the following Tuple Relational Calculus expressions?

(GATE 2014 | MCQ | 1-Mark)

  • [Tex]\{ t \mid \exists r \in R \wedge \exists s \in S (t[A] = r[A] \wedge r[B] = s[B]) \}[/Tex]

  • [Tex]\{ t \mid \exists r \in R (t[A] = r[A] \wedge \exists s \in S (r[B] = s[B])) \}[/Tex]

  • [Tex]\{ t \mid \exists r \in R (t[A] = r[A] \wedge \forall s \in S (r[B] = s[B])) \}[/Tex]

  • Both A and B

Question 6

What is the correct syntax for a Domain Relational Calculus query?

  • { t | P(t) } where t is a tuple

  • { <x1,x2> | P(x1,x2) } where x1,x2 are domain variables

  • SELECT x1,x2 WHERE P(x1,x2)

  • [x1,x2 ∈ r | P(x1,x2)]

Question 7

How would you express "Find customers who have loans of exactly 200 amount" in DRC?

  • { <c> | ∃ l,b ( <c,l> ∈ borrower ∧ <l,b,200> ∈ loan ) }

  • { <c> | <c,200> ∈ loan }

  • { <c,l> | <c,l> ∈ borrower ∧ amount=200 }

  • { <c> | ∀ l,b ( <c,l> ∈ borrower ∧ <l,b,200> ∈ loan ) }

Question 8

In DRC, what does the notation ≺l,b,a≻ represent?

  • A tuple variable spanning multiple tables

  • An ordered set of domain variables

  • A join condition between relations

  • A projection operation

Question 9

Which query finds customers with loans at "Main" branch AND amount > 100?

  • { <c> | ∃ l,b,a ( <c,l> ∈ borrower ∧ <l,b,a> ∈ loan ∧ b="Main" ∨ a>100 ) }

  • { <c,a> | ∃ l ( <c,l> ∈ borrower ∧ <l,"Main",a> ∈ loan ∧ a>100 ) }

  • { <c> | ∀ l,b,a ( <c,l> ∈ borrower ∧ <l,b,a> ∈ loan → (b="Main" ∧ a>100) ) }

  • { <c> | <c,"Main"> ∈ borrower ∧ <,,>100> ∈ loan }

Question 10

What distinguishes DRC from Tuple Relational Calculus (TRC)?

  • DRC uses domain variables while TRC uses tuple variables

  • DRC is procedural while TRC is declarative

  • DRC can't express quantifiers while TRC can

  • DRC requires SQL syntax while TRC doesn't

There are 10 questions to complete.

Take a part in the ongoing discussion