Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2016 Set 2
Questions

Q52

NAT2 marksDatabasesMedium

Consider the following database table named water_schemes:

scheme_nodistrict_namecapacity1Ajmer201Bikaner102Bikaner103Bikaner201Churu102Churu201Dungargarh10Water_schemes\overset{\text{Water\_schemes}}{\begin{array}{|c|c|c|}\hline \textbf{scheme\_no}& \textbf{district\_name}& \textbf{capacity} \\\hline 1& \text{Ajmer}& 20 \\ \hline 1& \text{Bikaner}& 10 \\ \hline 2& \text{Bikaner}& 10 \\\hline 3& \text{Bikaner}&20 \\\hline 1& \text{Churu}& 10 \\\hline 2& \text{Churu}& 20 \\\hline 1& \text{Dungargarh}& 10 \\\hline \end{array}}

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
Sign in to save attempts.

Solutions and discussion are hidden while you attempt this question. They open once you check or show the answer.