reset password
Author Message
calikidd
Posts: 41
Posted 09:06 Oct 17, 2010 |

4.20 b

I'm a little confuse on the question. Is it asking that we pretty much add up the years and get the average? If that is the case, then I could do it  by just dividing by the total number of years and without using the avg function. 

cysun
Posts: 2935
Posted 10:45 Oct 17, 2010 |

avg() = sum() / count()

So yes, you can do average without using avg().

The wording of problem is indeed kind of odd. It should have said "The average section size by year". Note that you are supposed to display the average section size of each year, so it's not divided by the number of years. It should be the number of students each year divided by the number of sections of that year.

cysun
Posts: 2935
Posted 10:55 Oct 17, 2010 |

BTW, 4.20 (b) is not in HW2. Feel free to use it for practice though.

calikidd
Posts: 41
Posted 12:50 Oct 17, 2010 |

Ok, thanks, I didn't realize that it was not part of the HW.

rhardytran
Posts: 8
Posted 08:08 Oct 19, 2010 |

There are some questions in HW2 that require 2 or more queries to complete it.  For example, 4.21c requires 2 queries to get the student GPA & major GPA.  Is that OK?  or I have to run it in one query.

cysun
Posts: 2935
Posted 08:10 Oct 19, 2010 |
rhardytran wrote:

There are some questions in HW2 that require 2 or more queries to complete it.  For example, 4.21c requires 2 queries to get the student GPA & major GPA.  Is that OK?  or I have to run it in one query.

You have to do it in one query.