GATE CS 2017 (Forenoon) — Question 23

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

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
Question image
sql
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)
8
The output of executing the SQL query is
Practise the full 2017-FN paper
Challenge a friend: WhatsApp Telegram
From RENYXERAPractise this subject in the exam simulatorTimed, GATE-style tests with analytics that find your weak topics.
Practise more on SQL Queries (DDL/DML, Joins, Aggregations)Timed, in the real exam interface · free to start

A GATE question every morning

One real past-paper question every morning for your branch, answer hidden until you tap. Free on Telegram.

Join
Stuck? Ask in the student group