Database miscellaneous


Database miscellaneous

  1. Which of the following relational calculus expressions is not safe?









  1. View Hint View Answer Discuss in Forum

    {t | ̚ (t ∈ R)}
    This option contradicts itself. We want a tuple t and t itself is in r1 and we want other tuples than t by using negation so it’s not safe.

    Correct Option: C

    {t | ̚ (t ∈ R)}
    This option contradicts itself. We want a tuple t and t itself is in r1 and we want other tuples than t by using negation so it’s not safe.


  1. Suppose the adjacency relation of vertices in a graph is represented in a table Adj (X, Y). Which of the following queries cannot be expressed by a relational algebra expression of constant length?









  1. View Hint View Answer Discuss in Forum

    (A) ⇒ This is simple select query query.
    (B) ⇒ This is simple query we need to check X=Y in where clause.
    (C) ⇒ Cycle < 3. Means cycle of length 1 & 2. Cycle of length 1 is easy., Same as self loop. Cycle of length 2 is is also not too hard to compute. Though it'll be little complex, will need to do like (X,Y) & (Y, X) both present & X! = Y,. We can do this with constant RA query.
    (D) ⇒ This is most hard part. Here we need to find closure of vertices. This willl need kind of loop. If the graph is like skewed tree, our query must loop for O(N) Times. We can't do with constant length query here.

    Correct Option: D

    (A) ⇒ This is simple select query query.
    (B) ⇒ This is simple query we need to check X=Y in where clause.
    (C) ⇒ Cycle < 3. Means cycle of length 1 & 2. Cycle of length 1 is easy., Same as self loop. Cycle of length 2 is is also not too hard to compute. Though it'll be little complex, will need to do like (X,Y) & (Y, X) both present & X! = Y,. We can do this with constant RA query.
    (D) ⇒ This is most hard part. Here we need to find closure of vertices. This willl need kind of loop. If the graph is like skewed tree, our query must loop for O(N) Times. We can't do with constant length query here.



  1. From the following instance of a relational schema R(A, B, C), we can conclude that










  1. View Hint View Answer Discuss in Forum

    Generally Normalization is done on the schema itself. From the relational instance given,we may strike out FD s that do not hold.
    e.g.B does not functionally determine C(This is true). But we cannot say that A functionally determines B for the entire relation itself.This is because that, A → B holds for this instance,but in future there might be some tuples added to the instance that may violate A → B. So overall on the relation we cannot conclude that A → B,from the relational instance which is just a subset of an entire relation.

    Correct Option: C

    Generally Normalization is done on the schema itself. From the relational instance given,we may strike out FD s that do not hold.
    e.g.B does not functionally determine C(This is true). But we cannot say that A functionally determines B for the entire relation itself.This is because that, A → B holds for this instance,but in future there might be some tuples added to the instance that may violate A → B. So overall on the relation we cannot conclude that A → B,from the relational instance which is just a subset of an entire relation.


  1. Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName, DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following queries on the database expressed in tuple relational calculus.
    (I) {t | ∀ u ∈ EMP(t[EmpName] = u[EmpName] ∧ v ∈ DEPT(t[DeptId] ≠ v[DeptId]))}
    (II) {t | ∀ u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃ v ∈ DEPT(t[DeptId] ≠ v[DeptId]))}
    (III) {t | ∀ u ∈ EMP(t[EmpName] = u[EmpName] ∧ ∃ v ∈ DEPT(t[DeptId] = v[DeptId]))}
    Which of the above queries are safe?









  1. View Hint View Answer Discuss in Forum

    Consider the each option.
    (i) The results empname who does not belongs to any departments.
    (ii) The results empname who does not belongs to some departments.
    (iii) The results empname who belongs to same departments. All the given queries generate finite number of tuple hence all are safe query.
    Hence, option (d) is correct.

    Correct Option: D

    Consider the each option.
    (i) The results empname who does not belongs to any departments.
    (ii) The results empname who does not belongs to some departments.
    (iii) The results empname who belongs to same departments. All the given queries generate finite number of tuple hence all are safe query.
    Hence, option (d) is correct.



  1. Which of the following is NOT a superkey in a relational schema with attributes V,W, X, Y, Z and primary key V Y?









  1. View Hint View Answer Discuss in Forum

    Super key = Candidate key + other attributes. But option (b) does not include Y which is part of candidate Key.

    Correct Option: B

    Super key = Candidate key + other attributes. But option (b) does not include Y which is part of candidate Key.