Question
Consider a relation Seen(name,bird,place,date) about bird sightings. Each tuple records the name of a birdwatcher who has seen some bird at a certain place on
Consider a relation Seen(name,bird,place,date) about bird sightings. Each tuple records the name of a birdwatcher who has seen some bird at a certain place on a certain date. Consider the following SQL expression:
with N as (select name, count(bird) as number from Seen group by name) select * from N natural join (select max(number) as number from N)
Which of the following statements are correct?
1. | This expression returns the names of birdwatchers with the most sightings, together with the number of those sightings. | |
2. | This expression returns pairs (name,number) where name is the name of a birdwatcher and number is the number of sightings reported by that birdwatcher. | |
3. | An equivalent way to write the same query in SQL is as follows: select name, max(number) from (select name, count(bird) as number from Seen group by name) group by name | |
4. | An equivalent way to write the same query in SQL is as follows: with N as (select name, count(bird) as number from Seen group by name) select * from (select name from N) natural join (select max(number) as number from N) | |
5. | This expression returns the names of birdwatchers who have seen the largest number of different birds, together with the number of these. |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started