SQL questions

Q56

GATE CS 2022 CSRelational QueriesNAT2 marks
Consider the relational database with the following four schemas and their respective instances.

Student(sNo‾\underline{\text{sNo}}, sName, dNo) Dept(dNo‾\underline{\text{dNo}}, dName)
Course(cNo‾\underline{\text{cNo}}, cName, dNo) Register(sNo‾\underline{\text{sNo}}, cNo‾\underline{\text{cNo}})

Student
sNosNamedNo
S01JamesD01
S02RockyD01
S03JacksonD02
S04JaneD01
S05MilliD02
Dept
dNodName
D01CSE
D02EEE
Course
cNocNamedNo
C11DSD01
C12OSD01
C21DED02
C22PTD02
C23CVD03
Register
sNocNo
S01C11
S01C12
S02C11
S03C21
S03C22
S03C23
S04C11
S04C12
S05C11
S05C21
SQL Query:
SELECT * FROM Student AS S WHERE NOT EXIST
 (SELECT cNo FROM Course WHERE dNo = “D01”
 EXCEPT
 SELECT cNo FROM Register WHERE sNo = S.sNo)
The number of rows returned by the above SQL query is___________.
Show answer without attempting

Answer: 2

0/10 correct0 marks

Related topics in Relational Queries