Newer
Older
labs / tiddlers / content / labs / lab05 / _Labs_05_Task 2_ Join Exercises.md

Write SQL SELECT statements to answer the following questions. Make sure you save your code somewhere for future reference.

Note that an empty query result may not necessarily indicate an error.

  1. List the site ID, date, region, description, and altitude of all samples, in date order.
  2. List all samples that were gathered at an altitude of between 0 and 100 metres. (Hint: This should look familiar. Can you re-use something you’ve already done?)
  3. List the names (in alphabetical order) of scientists who have gathered samples in the Dunedin region.
  4. Output full details of all samples, including the scientist and the site.
  5. List the names (in alphabetical order) of scientists who haven’t yet gathered a sample. (Hint: You’ll need to use an outer join. Remember that unmatched columns are filled with nulls.)