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

+25 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.4k
- Engineering Mathematics 5.7k
- Digital Logic 2.2k
- Programming & DS 4.1k
- Algorithms 3.6k
- Theory of Computation 4.5k
- Compiler Design 1.7k
- Databases 3.2k
- CO & Architecture 2.8k
- Computer Networks 3.2k
- Non GATE 1.1k
- Others 1.5k
- Admissions 503
- Exam Queries 474
- Tier 1 Placement Questions 22
- Job Queries 61
- Projects 13

39,713 questions

46,750 answers

140,552 comments

58,385 users