- Simple Queries (4)
- Setting criteria using WHERE (5)
- Calculations (7)
- Calculations using dates (4)
- Basic joins (8)
- More exotic joins (2)
- Aggregation and grouping (8)
- Views (5)
- Subqueries (5)
- Stored procedures (5)
- Variables (8)
- Parameters and return values (11)
- Testing conditions (1)
- Looping (3)
- Scalar functions (6)
- Transactions (5)
- Creating tables (5)
- Temporary tables and table variables (9)
- Table-valued functions (6)
- Derived tables and CTEs (13)
- Dynamic SQL (4)
- Pivots (2)
- Triggers (2)
- Archived (70)
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.
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:
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):
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.