Wednesday, 3 June 2020

UGC NET Computer Science December 2019 | Question 72

Question 72
Given two tables
EMPLOYEE (EID, ENAME, DEPTNO)
DEPARTMENT (DEPTNO, DEPTNAME)

Find the most appropriate statement of the given query :
Select count (*) 'total' from EMPLOYEE
where DEPTNO IN (D1, D2)
group by DEPTNO having count (*) > 5
  1. 1. Total number of employees in each department D1 and D2
  2. 2. Total number of emplovees of department D1 and D2 if their total is > 5
  3. 3. Display total number of employees in both departments D1 and D2
  4. 4. The output of the query must have atleast two rows
Answer : 2. Total number of emplovees of department D1 and D2 if their total is > 5

Explanation
Given query group by distinct DEPTNO on the EMPLOYEE relation having rows with same DEPTNO are greater than 5 (i.e. no. of employees for those dept. are greater than 5) and it also further filters only department D1 and D2 using IN(list...) query.

So, option 2 is correct answer.

Reference : SQL HAVING Clause Example

PreviousNext
UGC NET CS December 2019 - Question 71UGC NET CS December 2019 - Question 73

No comments:

Post a Comment

UGC NET Computer Science December 2019 | Question 16

Question 16 In a certain coding language. 'AEIOU' is written as 'TNHDZ'. Using the same coding language. 'BFJPV' wil...

Popular Posts