YouTube

Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← One Query Not Two - Intro to Relational Databases

Get Embed Code
4 Languages

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

  1. So, here's one possible answer.
  2. Inside these parentheses,
  3. is a select statement that
    returns the average weight.
  4. We call this table subQ,
    because SQL makes us give it some name,
  5. even though we don't use that name.
  6. And then we're joining that
    back to player's table, and
  7. then doing a where restriction for
  8. rows where the player's weight,
    is less than the computed average.
  9. Let's look at that in more detail.
  10. First, start with the sub query.
  11. It does an average aggregation.
  12. Producing this little one
    by one table called a subq.
  13. Then, that gets joined
    to the players table.
  14. Making this one.
  15. This then gets filtered, for entries
    where weight is less than average.
  16. Finally, we just take the name and
    the weight columns.