reset password
Author Message
selyaho
Posts: 3
Posted 19:29 Jul 19, 2009 |

I am a little confused as what the expected result should be.

What we are doing is that we get the setudents whose graduation year was 2005 and out of those students we filter out the only one who took more classes than the rest of the students whose year of graduation was 2005?

alomo
Posts: 70
Posted 20:07 Jul 19, 2009 |
selyaho wrote:

What we are doing is that we get the setudents whose graduation year was 2005 and out of those students we filter out the only one who took more classes than the rest of the students whose year of graduation was 2005?

 

The number of students who took the most courses in 2005 could be more than one.

 

selyaho
Posts: 3
Posted 20:16 Jul 19, 2009 |

I remember it was covered in the class that there is a more efficient way than order by and limit to trim out the ones with the maximum values. How do does that method work?

cysun
Posts: 2935
Posted 08:35 Jul 20, 2009 |
selyaho wrote:

...

What we are doing is that we get the setudents whose graduation year was 2005 and out of those students we filter out the only one who took more classes than the rest of the students whose year of graduation was 2005?

I guess this would be another way to put it.

cysun
Posts: 2935
Posted 08:40 Jul 20, 2009 |
selyaho wrote:

I remember it was covered in the class that there is a more efficient way than order by and limit to trim out the ones with the maximum values. How do does that method work?

I don't know what you are referring to, but we mentioned the following in the class:

  • Use order by and limit to answer Top N queries.
  • For Top N queries, handle the case where there are multiple entries tied for the Nth place. See Example 32.
  • Do not use PL to reimplement DBMS built-in functionality like max().