Exercise: Combine criteria to show possibly watery post-1970 events!

This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.

The answer to the exercise will be included and explained if you attend the course listed below!

Category ==> SQL  (156 exercises)
Topic ==> Setting criteria using WHERE  (5 exercises)
Level ==> Harder than average
Course ==> Introduction to SQL
Before you can do this exercise, you'll need to download and unzip this file (if you have any problems doing this, click here for help). Once you've done this:
  1. Go into SQL Server Management Studio;
  2. Open the SQL file you've just unzipped (you can press CTRL + O to do this); then
  3. Execute this script.

This will generate the database that you'll need to use in order to do this exercise (note that the database and script are only to be used for exercises published on this website, and may not be reused or distributed in any form without the prior written permission of Wise Owl).

You need a minimum screen resolution of about 700 pixels width to see our exercises. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.

First show a list of all events which might have something to do water.  The Wise Owl interpretation of this is that one or more of the following is true:

  • They take place in one of the island countries (8, 22, 30 and 35, corresponding to Japan, the Marshall Islands, Cuba and Sri Lanka respectively)
  • Their EventDetails column contains the word Water (not the text Water, but the word)
  • Their category is number 4 (Natural World)

This should return 11 rows.  Now add a criterion to show only those events which happened since 1970 (you may need to use parentheses to get this to give the correct answer).

Here's what you should see as a result:

The results

The final results from running this complicated query.

Save this as Somewhat contrived, then close it down.

This page has 1 thread Add post
18 Jul 17 at 09:55

Combine criteria to show possibly watery post-1970 events!

Thee are only 4 events under the CategoryID 4. How come you have five in your solution?

30 Jul 17 at 10:02

The clue is in the question!

"one OR more of the following is true"