SQL | Basic joins exercise | Creating a simple join between two tables using the designer

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.

Software ==> SQL  (198 exercises)
Version ==> Any version of SQL Server
Topic ==> Basic joins  (8 exercises)
Level ==> Relatively easy
Subject ==> SQL training
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).

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.

If you haven't already done so, run the script in the folder above to generate the Doctor Who database.

Right-click in a new query and use the designer to create a query linking these two tables:

Two tables

Each episode is linked to the person who wrote it.

Add columns and filters to your query so that it shows who wrote the "special" episodes (there should be 13 listed out, of which the first few in alphabetical order are shown below):

First few episodes

The first few episodes containing the word special in the title.

For the filter, use the criteria LIKE '%special%'.

Now tidy up the generated query so that it looks more like proper SQL!  Here's a suggestion:

-- the query, tidied up







INNER JOIN tblEpisode ON

tblAuthor.AuthorId = tblEpisode.AuthorId


tblEpisode.EpisodeType LIKE '%special%'



Save this query as No joins necessary, then close it down.

You can unzip this file to see the answers to this exercise, although please remember this is for your personal use only.
This page has 0 threads Add post