1
GATE CSE 2016 Set 2
Numerical
+2
-0
Consider the following database table named $$water$$_$$schemes :$$

water_schemes
scheme_no district_name capacity
1 Ajmer 20
1 Bikaner 10
2 Bikaner 10
3 Bikaner 20
1 Churu 10
2 Churu 20
1 Dungargarh 10

The number of tuples returned by the following $$SQL$$ query is _______________.

with total(name, capacity) as
select district_name, sum(capacity)
from water_schemes
group by district_name
with total_avg(capacity) as
select avg(capacity)
from total
select name
from total, total_avg
where total.capacity ≥ total_avg.capacity
2
GATE CSE 2015 Set 1
Numerical
+2
-0

Consider the following relation:

Student

Roll_No Student_Name
1 Raj
2 Rohit
3 Raj

Performance

Roll_No Course Marks
1 Math 80
1 English 70
2 Math 75
3 English 80
2 Physics 65
3 Math 80

Consider the following SQL query.

SELECT S.Student_Name, Sum(P.Marks)
FROM Student S, Performance P
WHERE S.Roll_No= P.Roll_No
GROUP BY S.STUDENT_Name
The numbers of rows that will be returned by the SQL query is___________.
3
GATE CSE 2014 Set 2
+2
-0.6
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of joins. Which one of the following queries always gives the same answer as the nested query shown below:
Select * from R where a in (select S.a from S)
A
Select R.* from R, S where R.a = S.a
B
Select distinct R.* from R, S where R.a = S.a
C
Select R.* from R, (select distinct a from S) as S1 where R.a = S1.a
D
Select R.* from R, S where R.a = S.a and is unique R
4
GATE CSE 2014 Set 3
+2
-0.6

Consider the following relational schema:

employee (empId, empName, empDept )

customer (custId, custName, salesRepId, rating)

SalesRepId is a foreign key referring to empId of the employee relation. Assume that each employee makes a sale to at least one customer. What does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS (SELECT custId
FROM customer C
WHERE C.salesRepId = E.empId
AND C.rating <> 'GOOD');
A
Names of all the employees with at least one of their customers having a 'GOOD' rating.
B
Names of all the employees with at most one of their customers having a 'GOOD' rating.
C
Names of all the employees with none of their customers having a 'GOOD' rating.
D
Names of all the employees with all their customers having a 'GOOD' rating.
GATE CSE Subjects
EXAM MAP
Medical
NEET