The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+20 votes
1.4k views

Which of the rational calculus expression is not safe?

  1. $\left\{t \mid \exists u \in R_1\left(t[A] = u[A]\right) \land \neg \exists s \in R_2 \left(t[A] = s[A]\right)\right\}$
  2. $\left\{ t \mid \forall u \in R_1\left(u[A]="x" \Rightarrow \exists s \in R_2\left(t[A] = s[A] \land s[A] = u[A]\right)\right) \right\} $
  3. $\left\{t \mid \neg (t \in R_1)\right\} $
  4. $\left\{t \mid \exists u \in R_1\left(t[A]=u[A]\right) \land \exists s \in R_2 \left(t[A] = s[A]\right)\right\}$

 

asked in Databases by Veteran (59.4k points)
edited by | 1.4k views
0
Should the variable t not bounded to a relation as well ? If it is not bounded to a relation then shouldn't t yield infinite no. of tupples in A,B and D. From what I have read the notation followed is { t | R(t) ^ <set of conditions> } .
0

Someone please explain how to read Queries 1, 2 and 3. Are they from TRC or DRC and how to interpret them in some English language!

0

.....

+1
Does not help at all !!!

2 Answers

+23 votes
Best answer
Answer: C

It returns tuples not belonging to R1 (which is infinitely many). So, it is not safe.

Ref: http://nptel.ac.in/courses/IIT-MADRAS/Intro_to_Database_Systems_Design/pdf/3.1_Tuple_Relational_Calculus.pdf
answered by Boss (34.1k points)
selected by
0
it is unsafe because of infinite cardinality or inability to show all output ??
m not getting meaning of safe expression.
please explain
+2
Safe expressions will give you definite number of tuples.
0
Can anyone give example of unsafe expression in any context / schema which does not involve negation to yield infinite tuples? I am searching for one such. Is this even possible? @Arjun sir?
+5

Consider a relational schema R1 and generally it can take infinite values if domains of attributes aren't restricted.So for any finite instances of relation {t∣¬(tR1)}  will generate instance with infinite tuples so it is unsafe.

eg. R1(Roll Number, Marks) and consider domain of Roll number +ve integers. restriction on marks doesn't matter.

consider a instance of R1

R1
Roll Number Marks
                 1       22
                  2        78

 

 

 

 

now this {t∣¬(tR1)} will generate all possible value that can be in roll number and Marks exclusing (1,22) and (2,78). That will be infinite so this query is unsafe.

–3 votes
both a) and c) should be true....can someone plz explain the correct answer
answered by Active (1.3k points)
+10
A) A is not unsafe, because we have intersection with R1, so at max we can get all tuples from R1. There is no such restriction in C. So A is not answer
!
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

34,770 questions
41,730 answers
118,876 comments
41,381 users