CS 330
Lecture 8
Examples


Nested queries

Aggregate functions

  1. Find average age of sailors.
  2. Find average age of sailors with a rating of 10.
  3. Find name and age of oldest sailor.
  4. Count number of sailors.
  5. Count number of distinct names in Sailors.
  6. Find names of sailors who are older than oldest sailor with a rating of 10.
  7. Find age of the youngest sailor at each rating level.
  8. Find age of the youngest sailor older than 18, for each rating level with at least two such sailors.
  9. For each red boat find the number of reservations for it.
  10. Find average age of sailors [older than 18] for each rating level that has at least 2 sailors.

Ileana Streinu