GateAI
Relational Model and SQL

GATE CSE 2017 Set 1 · Q23

NAT1 markEasy

Time

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

GATE CSE 2017 Set 1 Q23 diagram 1
GATE CSE 2017 Set 1 Q23 diagram 2

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 2.6 (±0)

Relational Model and SQL

Let us analyze the query and the data:

  1. The subquery groups the relation EMP by DeptName and counts the number of employees in each department:

    • Department AA: 44 employees (EmpId 1, 2, 3, 4)

    • Department AB: 33 employees (EmpId 5, 6, 7)

    • Department AC: 33 employees (EmpId 8, 9, 10)

    • Department AD: 22 employees (EmpId 11, 12)

    • Department AE: 11 employee (EmpId 13)

  2. The subquery returns the pairs: (AA, 4), (AB, 3), (AC, 3), (AD, 2), (AE, 1).

  3. The outer query computes the average of Num across all departments selected:

    Average=4+3+3+2+15=135=2.6\text{Average} = \frac{4 + 3 + 3 + 2 + 1}{5} = \frac{13}{5} = 2.6

Thus, the output of the query is 2.6.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Relational Model and SQL previous year question is Q23 of the GATE CSE 2017 Set 1 paper. Find more GATE CSE PYQs on Relational Model and SQL in Databases, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Relational Model and SQL PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Relational Model and SQL in GATE CSE

Relational Model and SQL has 15 GATE CSE PYQs across 12 papers from 2011 to 2026. 2 of them are 1-mark NAT questions like this one, and GATE CSE 2017 Set 1 has 3.

How GATE tests Relational Model and SQL

More from GATE CSE 2017 Set 1

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2017 Set 1 · Q23 · NAT

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

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.