Relational Queries questions

Q35

GATE CS 2013 CSRelational QueriesMCQ2 marks−2/3 if wrong
Consider the following relational schema.

Students(rollno: integer‾\underline{\text{rollno: integer}}, sname: string)
Courses(courseno: integer‾\underline{\text{courseno: integer}}, cname: string)
Registration(rollno: integer, courseno: integer‾\underline{\text{rollno: integer, courseno: integer}}, percent: real)

Which of the following queries are equivalent to this query in English?
"Find the distinct names of all students who score more than 90% in the course numbered 107"

(I) SELECT DISTINCT S.sname
FROM Students as S, Registration as R
WHERE R.rollno=S.rollno AND R.courseno=107 AND R.percent > 90
(II) Πsname(σcourseno=107∧percent>90(Registration⋈Students))\Pi_{\text{sname}}(\sigma_{\text{courseno}=107 \wedge \text{percent}>90}(\text{Registration} \bowtie \text{Students}))
(III) {T∣∃S∈Students,∃R∈Registration(S.rollno=R.rollno∧R.courseno=107∧R.percent>90∧T.sname=S.sname)}\{T \mid \exists S \in \text{Students}, \exists R \in \text{Registration} (S.\text{rollno}=R.\text{rollno} \wedge R.\text{courseno}=107 \wedge R.\text{percent}>90 \wedge T.\text{sname}=S.\text{sname})\}
(IV) {⟨SN⟩∣∃SR∃RP(⟨SR,SN⟩∈Students∧⟨SR,107,RP⟩∈Registration∧RP>90)}\{\langle S_N \rangle \mid \exists S_R \exists R_P (\langle S_R, S_N \rangle \in \text{Students} \wedge \langle S_R, 107, R_P \rangle \in \text{Registration} \wedge R_P > 90)\}
Show answer without attempting

Answer: A

0/10 correct0 marks

Related topics in Databases