WISE OWL EXERCISES
- 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 | Archived exercise | Create table of actors and directors born in 1969
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 relevant Wise Owl course (sadly, only in the UK for now).
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.
The aim of this exercise is to create a temporary table of all of the actors and directors born in 1969:
The flower children in date of birth order - 10 actors, but only 1 director
To do this, first create a command to select all of the actors born in 1969 into a new temporary table.
Be careful! Because you're soon going to be adding the directors to this temporary table, check that you cast the actor name column to a data type compatible with the director's name.
Now add a command to insert all of the directors born in 1969 into the temporary table.
Display the contents of the temporary table - it should look as shown at the start of this exercise.
Thought for the day - you could have solved this problem using a UNION ALL query (take a look at the answer to this exercise if you've never created a union query). Which method do you prefer?
Save the query to create and display the temporary table as Flower children, then close it down.