reset password
Author Message
aligh1979
Posts: 121
Posted 01:37 Oct 20, 2010 |

Hi professor , could you please one more time clarify the problem number 4.20 c , e (guess both are sort of the same) , I do not get it exactly .

thank you

here is the c)

Q : the sections that were larger than the avererage section size for their year

cysun
Posts: 2935
Posted 08:49 Oct 20, 2010 |

Consider the following data:

# of students section id year
30 21 2010
15 22 2010
10 23 2010
30 13 2009
20 12 2009

The average section size in 2010 is (30+15+10)/3 = 18.3, and the average section size of 2009 is 25.

For (c), the results should be

# of students section id year
30 21 2010
30 13 2009

For (e), the results should be

year
2009
Last edited by cysun at 08:50 Oct 20, 2010.
aligh1979
Posts: 121
Posted 04:08 Oct 23, 2010 |

I am still thinking about the C part , I have got the first table with each section and year and their size(students) , and another query with each year , section id and the average of the section_size .

I just do not know how to connect them , since if I use having , the second part of the condition is not just one value , it is a column of average size for each year . and I just do not know how to compare each separate year with the average of that year , not just a single value?

cysun
Posts: 2935
Posted 08:35 Oct 23, 2010 |
aligh1979 wrote:

...

I just do not know how to connect them , ...

Use a join.