English subtitles

← Select Clauses - Intro to Relational Databases

Get Embed Code
4 Languages

Showing Revision 3 created 05/24/2016 by Udacity Robot.

  1. So we have these three
    different situations.
  2. For the first one find
    the ten oldest gorillas.
  3. Well, we're going to need, where,
    in order to select out only gorillas.
  4. We're going to need to find the oldest,
  5. means we need to put them in
    order by their birthdates.
  6. And we want to find the top ten so
    that's going to be a limit.
  7. For the second one, list all the animals
    in alphabetical order, ten per page.
  8. We're listing all of the animals,
    not some of them.
  9. So we,
    don't actually need where on this query.
  10. We're listing them in alphabetical order
    though, so we're going to need order by.
  11. Since we want to get them ten per page,
    we're going to need limit and
  12. offset to put them into separate pages.
  13. For the third situation, find out
    which one species we have the most of.
  14. First we're going to need group by,
  15. to bin all the animals by species
    using account aggregation.
  16. Then we're going to need order by,
  17. to sort by the result of that count,
    and limit to get just the top one.
  18. There's actually another way to do this
    using a different SQL feature called
  19. subselects, but with what you've seen so
    far, this is how to do it.