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
The output of executing the SQL query is

sql
Database Management Systems (DBMS)SQL Queries (DDL/DML, Joins, Aggregations)NAT1 markMedium

1SELECT AVG(EC.Num)
2FROM EC
3WHERE (DeptName, Num) IN
4 (SELECT DeptName, COUNT(EmpId) AS
5 EC( DeptName, Num)
6 FROM EMP
7 GROUP BY DeptName)
8A GATE question every morning
One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.