Database miscellaneous


Database miscellaneous

  1. Consider the relation employee (name, sex, supervisorName) with name as the key. supervisorName gives the name of the supervisor of the employee under consideration. What does the following tuple relational calculus query produce?
    {e.name | employee (e) ∧}
    (∀ x) [ ̚ employee (x) ∨ x. supervisor Name ≠ e. name vx. sex = “male”]









  1. View Hint View Answer Discuss in Forum

    We are given with the below relational calculus:
    {e.name|employee (e) ∧}
    (∀x)[ ̚ employee (x) ∨ x.x.supervisorName ≠ x.sex = “male” ]}
    {e.name|employee (e) ∧} gives he name of the employee
    (∀x)[ ̚ employee (x)j v x.supervisorName ≠ x.sex = “male” ]} tells that employee does not have nay female subordinate.

    Correct Option: C

    We are given with the below relational calculus:
    {e.name|employee (e) ∧}
    (∀x)[ ̚ employee (x) ∨ x.x.supervisorName ≠ x.sex = “male” ]}
    {e.name|employee (e) ∧} gives he name of the employee
    (∀x)[ ̚ employee (x)j v x.supervisorName ≠ x.sex = “male” ]} tells that employee does not have nay female subordinate.


  1. Information about a collection of students is given by the relation studinfo (studld, name, sex). The relation enroll (studld, courseld) gives which student has enrolled for (or taken) what course(s). Assume that every course is taken by at least one male and at least one female student. What does the following relational algebra expression represent?
    Πcourseldstudldsex = “female” (studinfo) × Πcourseheld(enroll)) – enroll)









  1. View Hint View Answer Discuss in Forum

    sex = “female” (studinfo) tells that students are females.
    Πcourseld (enroll) gives the Id of the course in which to enroll.
    ΠstudId (enroll) tells regarding a proper subset of females that are enrolled.
    Finally, Πcourseheld tells Course in which a proper subset of female students are enrolled.

    Correct Option: B

    sex = “female” (studinfo) tells that students are females.
    Πcourseld (enroll) gives the Id of the course in which to enroll.
    ΠstudId (enroll) tells regarding a proper subset of females that are enrolled.
    Finally, Πcourseheld tells Course in which a proper subset of female students are enrolled.



  1. Let R and S be two relations with the following schemas.
    R(P. Q, R1, R2, R3)
    S (P. Q, S1, S2)
    Where {P, Q}is the key for both schemas. Which of the following queries are equivalent?
    1. Πp (R ⋈ S)
    2. Πp (R) ⋈ Πp (S)
    3. Πp ( ΠP , Q (R) ∩ ΠP , Q (S) )
    4. Πp ( ΠP , Q (R) ⋈ ΠP , Q (R) - ΠP , Q (S) ) )









  1. View Hint View Answer Discuss in Forum

    In I, Ps from natural join of R and S are selected. In III, all Ps from intersection of (P, Q) pairs present in R and S. IV is also equivalent to III because (R – (R – S)) = R I S. II is not equivalent as it may also include Ps where Qs are not same in R and S.

    Correct Option: D

    In I, Ps from natural join of R and S are selected. In III, all Ps from intersection of (P, Q) pairs present in R and S. IV is also equivalent to III because (R – (R – S)) = R I S. II is not equivalent as it may also include Ps where Qs are not same in R and S.


  1. Let R and S be relational schemas such that R = {a, b, c} and S = {c}. Now consider the following queries on the database:
    1. πR - S - πR - SR - S(r) × S - πr - S , S (r))
    2. { t | t ∈ πR - S(r) ∧ ∀ u ∈ s (∃ v ∈ r ( u = v[s] ∧ t = v[ R - S ] ) ) }
    3. { t | t ∈ πR - S(r) ∧ ∀ u ∈ s (∃ u ∈ s ( u = v[s] ∧ t = v[ R - S ] ) ) }
    4. Select R.a, R. b
    From R, S
    Where R.c = S.c
    Which of the above queries are equivalent?









  1. View Hint View Answer Discuss in Forum

    This is very clear from the options itself that the option 2 and option 4 are equivalent as option 2 is technical representation of code given in option 4. Therefore
    { t | t ∈ πR - S (r) ∈ ∃u ∈ s(∃v ∈ r(u = v[s] ∧ t = v [R - S])) }
    = Select R.a, R.b
    From R, S
    = Where R.c = S.c

    Correct Option: C

    This is very clear from the options itself that the option 2 and option 4 are equivalent as option 2 is technical representation of code given in option 4. Therefore
    { t | t ∈ πR - S (r) ∈ ∃u ∈ s(∃v ∈ r(u = v[s] ∧ t = v [R - S])) }
    = Select R.a, R.b
    From R, S
    = Where R.c = S.c



  1. Consider a relational table with a single record for each registered student with the following attributes:
    1. Registration_Number: Unique registration number for each registered student
    2. UID: Unique Identity Number, unique at the national level for each citizen
    3. Bank Account_Number: unique account number at the bank. A student can have multiple accounts or joint accounts. This attributes stores the primary account number
    4. Name: Name of the Student
    5. Hostel_Room: Room number of the hostel
    Which of the following options is incorrect?









  1. View Hint View Answer Discuss in Forum

    Candidate key cannot be commen. Here, the two students can have common account number, so bank account number will not work like candidate keys.

    Correct Option: A

    Candidate key cannot be commen. Here, the two students can have common account number, so bank account number will not work like candidate keys.