Gate CS-2006 Question Paper With Solutions

Q. 36 Consider the relation account (customer, balance) where customer is a primary key and there are no mall 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.

Query 1 : Select A. customer, count (B. customer) from account A, account B where A. customer group by A. customer

Query 2 : Select A. customer, 1+count(B. customer) from account A, accountB where A, balance<B, balance 7 group by A. customer

Consider these statements about Query 1 and Query 2.

  1.  Query 1 will produce the same row set as Query 2 for some but not all databases.
  2.  Both Query 1 and Query 2 are a correct implementation of the specification
  3.  Query1 is a correct implementation of the specification but Query 2 is not
  4.  Neither Query 1 nor Query 2 is a 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.
Learn More:   Gate CS-2014-3 Question Paper With Solutions

in decreasing balance order the assigning ranks using ODBC Which two of the above statements are correct?

(A) 2 and 5

(B) 1 and 3

(C) 1 and 4

(D) 3 and 5

Answer: (C)

Explanation:

Gate CS-2006 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here