Database miscellaneous


Database miscellaneous

  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. Consider a database that has the relation schema CR(StudentName. CourseName). An instance of the schema CR is as given below.

    The following query is made on the database.
    T1 ← πCourseNameStudentName= ‘SA’(CR))
    T2 ← CR ÷ T1
    The number of rows in T2 is _______.









  1. View Hint View Answer Discuss in Forum

    The given query is made on the database are:
    1.
    For T1 Result: find out the course name for the student name is ‘SA’ i.e.

    So, T1 = {CA, CB, CC} The number of rows in T1 is 3.
    2. T1 ← (CR ÷ T1)

    For T2 Result: find out the student name for which every course name of T1 are {CA, CB, CC} is:
    So, T2 = {SA, SC, SD, SF} Hence, the number of rows in T2 is 4.

    Correct Option: C

    The given query is made on the database are:
    1.
    For T1 Result: find out the course name for the student name is ‘SA’ i.e.

    So, T1 = {CA, CB, CC} The number of rows in T1 is 3.
    2. T1 ← (CR ÷ T1)

    For T2 Result: find out the student name for which every course name of T1 are {CA, CB, CC} is:
    So, T2 = {SA, SC, SD, SF} Hence, the number of rows in T2 is 4.



  1. Consider the following database table named water_schemes:

    The number of tuples returned by the following SQL query is ________.
    with total (name, capacity) as
        select district_name, sum (capacity)
        from water_schemes
        group by district_name
    with total_avg (capacity) as
        select avg (capacity)
        from total
    select name
        from total, total_avg
        where total.capacity ≠ total_avg.capacity









  1. View Hint View Answer Discuss in Forum

    First we should perform group by group. We get ajmer 1
    bikaner 3
    charu 2
    dungargarh 1
    Now we should perform total capacity we will get 100. Now perform avg. capacity on total 100 / 4 = 25. bikaner = 40 which is greater than 25 charu is 30 which is also greater than 25. Hence charu and bikaner will be printed therefore answer is 2 tuples.

    Correct Option: A

    First we should perform group by group. We get ajmer 1
    bikaner 3
    charu 2
    dungargarh 1
    Now we should perform total capacity we will get 100. Now perform avg. capacity on total 100 / 4 = 25. bikaner = 40 which is greater than 25 charu is 30 which is also greater than 25. Hence charu and bikaner will be printed therefore answer is 2 tuples.


  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.



  1. Consider a database that has the relation schema EMP (EmpId. EmpName, and DeptName). An instance of the schema EMP and a SQL query on it are given below.

    The output of executing the SQL query is_______.









  1. View Hint View Answer Discuss in Forum


    Result of outer query or Avg (NUM) =
    13
    = 2.6
    5

    Correct Option: B


    Result of outer query or Avg (NUM) =
    13
    = 2.6
    5