SQL questions

Q52

GATE CS 2016 CS-2Relational QueriesNAT2 marks
Consider the following database table named water_schemes :
scheme_nodistrict_namecapacity
1Ajmer20
1Bikaner10
2Bikaner10
3Bikaner20
1Churu10
2Churu20
1Dungargarh10
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
Show answer without attempting

Answer: 2.0

0/10 correct0 marks

Related topics in Relational Queries