1
GATE CSE 2005
MCQ (Single Correct Answer)
+2
-0.6
The relation book (title, price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list?
Select title
 From book as B
 Where (select count(*)
   From book as T
   Where T.price > B.price) < 5;
A
Titles of the four most expensive books
B
Title of the fifth most inexpensive book
C
Title of the fifth most expensive book
D
Titles of the five most expensive books
2
GATE CSE 2005
MCQ (Single Correct Answer)
+2
-0.6

A company maintains records of sales made by its salespersons and pays them commission based on each individual’s total sales made in a year. This data is maintained in a table with following schema:

salesinfo = (salespersonid, totalsales, commission)

In a certain year, due to better business results, the company decides to further reward its salespersons by enhancing the commission paid to them as per the following formula:

If commission < = 50000, enhance it by 2%
If 50000 < commission < = 100000, enhance it by 4%
If commission > 100000, enhance it by 6%

The IT staff has written three different SQL scripts to calculate enhancement for each slab, each of these scripts is to run as a separate transaction as follows:

T1: Update salesinfo
 Set commission = commission * 1.02
 Where commission < = 50000;

T2: Update salesinfo
 Set commission = commission * 1.04
 Where commission > 50000 and commission is < = 100000;

T3: Update salesinfo
 Set commission = commission * 1.06
 Where commission > 100000;
Which of the following options of running these transactions will update the commission of all salespersons correctly?
A
Execute T1 followed by T2 followed by T3
B
Execute T2, followed by T3; T1 running concurrently throughout
C
Execute T3 followed by T2; T1 running concurrently throughout
D
Execute T3 followed by T2 followed by T1
3
GATE CSE 2005
MCQ (Single Correct Answer)
+2
-0.6
In an inventory management system implemented at a trading corporation, there are several tables designed to hold all the information. Amongst these, the following two tables hold information on which items are supplied by which suppliers, and which warehouse keeps which items along with the stock-level of these items.

Supply = (supplierid, itemcode)
Inventory = (itemcode, warehouse, stocklevel)

For a specific information required by the management, following SQL query has been written

Select distinct STMP.supplierid 
From Supply as STMP 
Where not unique (Select ITMP.supplierid 
    From Inventory, Supply as ITMP 
    Where STMP.supplierid = ITMP.supplierid 
    And ITMP.itemcode = Inventory.itemcode 
    And Inventory.warehouse = 'Nagpur');
For the warehouse at Nagpur, this query will find all suppliers who
A
do not supply any item
B
supply exactly one item
C
supply one or more items
D
supply two or more items
4
GATE CSE 2004
MCQ (Single Correct Answer)
+2
-0.6

The employee information in a company is stored in the relation

Employee (name, sex, salary, deptName)

Consider the following SQL query

  Select deptName
  From Employee
  Where sex = ‘M’
  Group by deptName
  Having avg(salary) >
  (Select avg (salary) From Employee);
It returns the names of the department in which
A
the average salary is more than the average salary in the company
B
the average salary of male employees is more than the average salary of all male employees in the company
C
the average salary of male employees is more than the average salary of employees in the same department.
D
the average salary of male employees is more than the average salary in the company
GATE CSE Subjects
Software Engineering
Web Technologies
EXAM MAP
Medical
NEET
Graduate Aptitude Test in Engineering
GATE CSEGATE ECEGATE EEGATE MEGATE CEGATE PIGATE IN
CBSE
Class 12