Database miscellaneous


Database miscellaneous

  1. SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below :
    select * from R where a in (select S.a from S)
    select R.* from R, S where R.a = S.a









  1. View Hint View Answer Discuss in Forum

    The one that give same answer is: select R. * from R, (select distinct a from S) as S1 where R.a = S1.

    Correct Option: C

    The one that give same answer is: select R. * from R, (select distinct a from S) as S1 where R.a = S1.


  1. Consider the following relational schema: employee (empId,empName,empDept) customer(custId,custName,salesRepId,rating) salesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return?










  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    NA



  1. Consider the following relation
    Cinema (theater, address, capacity)
    Which of the following options will be needed at the end of the SQL query
    SELECT P1. address
    FROM Cinema P1
    Such that it always finds the addresses of theaters with maximum capacity?









  1. View Hint View Answer Discuss in Forum

    Inner query collects capacities of all the theatres and in outer query we are filtering the tuples with the condition “capacity>=All”. So the theatres which are having maximum capacity will be satisfy the conductivity and they will.

    Correct Option: A

    Inner query collects capacities of all the theatres and in outer query we are filtering the tuples with the condition “capacity>=All”. So the theatres which are having maximum capacity will be satisfy the conductivity and they will.


  1. Consider the following relations :

    Consider the following SQL query. SELECT S.
    Student_Name, sum (P.Marks)
    FROM Student S, Performance P
    WHERE S.Roll_No. = P.Roll_No.
    GROUP BY S.Student_Name
    The number of rows that will be returned by the SQL query is _______.









  1. View Hint View Answer Discuss in Forum

    Output table is

    Correct Option: B

    Output table is



  1. SELECT operation in SQL is equivalent to









  1. View Hint View Answer Discuss in Forum

    SELECT operation in SQL perform vertical partitioning which is made by projection operation in relational calculus, but SQL is multi-sets. Hence the projection operation in relational algebra, except that SELECT in SQL retains duplicates answer is correct.

    Correct Option: D

    SELECT operation in SQL perform vertical partitioning which is made by projection operation in relational calculus, but SQL is multi-sets. Hence the projection operation in relational algebra, except that SELECT in SQL retains duplicates answer is correct.