Home » Database » Database miscellaneous » Question

Database miscellaneous

  1. Consider the relation account (customer, balance) where customer is a primary key and there are no null values. We would like to rank customers according to decreasing balance. The customer with the largest balance gets rank 1. Ties are not broken but ranks are skipped: If exactly two customers have the largest balance they each get rank 1 and rank 2 is not assigned.

    Consider these statements about Query1 and Query2.
    1. Query1 will produce the same row set as Query2 for some but not all databases.
    2. Both Query2 and Query2 are correct implementation of the specification.
    3. Query1 is a correct implementation of the specification but Query2 is not.
    4. Neither Query1 nor Query2 is correct implementation of the specification.
    5. Assigning rank with a pure relational query takes less time than scanning in decreasing balance order assigning ranks using ODBC.
    Which two of the above statements are correct?
    1. 2 and 5
    2. 1 and 3
    3. 1 and 4
    4. 3 and 5
Correct Option: C

Query1 where A.balance<=B.balance → this line computes the A group of customers and the balance is less than or equal to the group B.
Query2 where A.balance < B.balance → this line computes the A group of customers and the balance is less than the group B.
Therefore, the row produced by query1 and query2 will be same but not in every case as the results of query1 and query2 differ in case where query1 has the situation <= but query2 has only <.
None of the query provides the correct implementation of the specification.



Your comments will be displayed only after manual approval.