The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+20 votes

Which of the rational calculus expression is not safe?

- $\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\}$
- $\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\} $
- $\left\{t \mid \neg (t \in R_1)\right\} $
- $\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\}$

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> } .

+24 votes

Best answer

Answer: C.

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

Reference: http://nptel.ac.in/courses/IIT-MADRAS/Intro_to_Database_Systems_Design/pdf/3.1_Tuple_Relational_Calculus.pdf

0

it is unsafe because of infinite cardinality or inability to show all output ??

m not getting meaning of safe expression.

please explain

m not getting meaning of safe expression.

please explain

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*∣¬(*t*∈*R*1)} 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

Roll Number | Marks |
---|---|

1 | 22 |

2 | 78 |

now this {*t*∣¬(*t*∈*R*1)} 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.

- All categories
- General Aptitude 1.3k
- Engineering Mathematics 5.4k
- Digital Logic 2.1k
- Programming & DS 3.8k
- Algorithms 3.3k
- Theory of Computation 4.1k
- Compiler Design 1.6k
- Databases 3k
- CO & Architecture 2.6k
- Computer Networks 3k
- Non GATE 1.1k
- Others 1.4k
- Admissions 496
- Exam Queries 443
- Tier 1 Placement Questions 19
- Job Queries 59
- Projects 9

37,111 questions

44,694 answers

127,233 comments

43,753 users