GATEverse
← GATE CSE 2017 Set 1

Q23

NAT1 mark

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:

EmpIdEmpNameDeptName1XYAAA2XYBAA3XYCAA4XYDAA5XYEAB6XYFAB7XYGAB8XYHAC9XYIAC10XYJAC11XYKAD12XYLAD13XYMAEEMP\small \overset{\text{EMP}}{\begin{array}{|c|c|c|}\hline \textbf{EmpId}& \textbf{EmpName}& \textbf{DeptName}\\\hline 1& \text{XYA}& \text{AA} \\ \hline 2& \text{XYB}& \text{AA} \\ \hline 3& \text{XYC}& \text{AA} \\\hline 4& \text{XYD}& \text{AA} \\\hline 5& \text{XYE}& \text{AB} \\\hline 6& \text{XYF}& \text{AB} \\\hline 7& \text{XYG}& \text{AB} \\\hline 8& \text{XYH}& \text{AC} \\\hline 9& \text{XYI}& \text{AC} \\\hline 10& \text{XYJ}& \text{AC} \\\hline 11&\text{XYK} & \text{AD} \\\hline 12 & \text{XYL}& \text{AD} \\\hline 13 & \text{XYM} & \text{AE} \\\hline\end{array}}

SELECT AVG(EC.Num) FROM EC WHERE (DeptName, Num) IN (SELECT DeptName, COUNT(EmpId) AS EC(DeptName, Num) FROM EMP GROUP BY DeptName) The output of executing the SQL query is _____________ .

Sign in to save attempts.

Loading…