Gate2017 cs Q30

0. 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.  
EMP
EmpIdEmp NameDept Name
1.XYAAA
2.XYBAA
3.XYCAA
4.XYDAA
5.XYEAB
6.XYFAB
7.XYGAB
8.XYHAC
9.XYIAC
10.XYJAC
11.XYKAD
12.XYLAD
13.XYMAE
SELECT AVG (EC.Num)
FROM EC
WHERE(DeptName, Num)IN
 (SELECT DeptName, COUNT(EmpId)AS
     EC(DeptName,Num)
 FROMEMP
 GROUP BY DeptName)


Note – Numerical Type question

  • Option : A
  • Explanation :
    EC 
    Dept NameNum
    AA4
    AB3
    AC3
    AD2
    AE1
      
    Avg(NUM) = 13/5 = 2.6
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *