GATE CS 2022 Set 1 — Question 56
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.NAT+2 / -0MediumDivisionRelational ModelDatabasesSubqueriesSQL
Databases → Relational Model → Division
Last updated
Question
Consider the relational database with the following four schemas and their respective instances.Student(sNo, sName, dNo) Dept(dNo, dName)
Course(cNo, cName, dNo) Register(sNo, cNo)
SQL Query:The number of rows returned by the above SQL query is___________.
Course(cNo, cName, dNo) Register(sNo, cNo)
| Student | ||
|---|---|---|
| sNo | sName | dNo |
| S01 | James | D01 |
| S02 | Rocky | D01 |
| S03 | Jackson | D02 |
| S04 | Jane | D01 |
| S05 | Milli | D02 |
| Dept | |
|---|---|
| dNo | dName |
| D01 | CSE |
| D02 | EEE |
| Course | ||
|---|---|---|
| cNo | cName | dNo |
| C11 | DS | D01 |
| C12 | OS | D01 |
| C21 | DE | D02 |
| C22 | PT | D02 |
| C23 | CV | D03 |
| Register | |
|---|---|
| sNo | cNo |
| S01 | C11 |
| S01 | C12 |
| S02 | C11 |
| S03 | C21 |
| S03 | C22 |
| S03 | C23 |
| S04 | C11 |
| S04 | C12 |
| S05 | C11 |
| S05 | C21 |
SELECT * FROM Student AS S WHERE NOT EXIST
(SELECT cNo FROM Course WHERE dNo = "D01"
EXCEPT
SELECT cNo FROM Register WHERE sNo = S.sNo)
Correct answer
2 to 2
Solution
The SQL query performs a relational division operation. It selects all students from the
Student table who have registered for every course offered by department 'D01'.1.Identify courses in department 'D01': From the
Course table, these are {C11, C12}.2.Check each student's registrations from the
Register table:- S01: Registered for {C11, C12}. (Matches all D01 courses)
- S02: Registered for {C11}. (Missing C12)
- S03: Registered for {C21, C22, C23}. (Missing C11, C12)
- S04: Registered for {C11, C12}. (Matches all D01 courses)
- S05: Registered for {C11, C21}. (Missing C12)
Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE CS question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Relational Model
2026 Set 2 Q15In the context of DBMS, consider the two sets T and S given below. | T | S | |---|---| | I:…2026 Set 2 Q20Consider concurrent execution of two transactions and in a DBMS, both of which access a…2026 Set 1 Q30Let and be the attributes of a relation in a relational schema. Let…2026 Set 1 Q31In the context of relational database normalization, which of the following statements is/are true?2026 Set 2 Q42In the context of schema normalization in relational DBMS, consider a set F of functional…