ALL SOFTWARE EXERCISES
- EXERCISES HOME PAGE (777)
- Access 2010 (66)
- Access VBA Macros (17)
- Advanced VBA (29)
- ASP.NET MVC (0)
- ASP.NET webforms - C# (25)
- ASP.NET webforms - VB (27)
- Excel 2010 (83)
- Excel 2013 (10)
- Excel VBA Macros (37)
- Power BI - Excel 2013 (25)
- Power BI Desktop (26)
- PowerPivot 2010 (26)
- Report Builder 3.0 (42)
- SQL (116)
- SSAS - multidimensional (21)
- SSAS - tabular (29)
- SSIS Integration Services (18)
- SSRS Reporting Services (53)
- Visual Basic 2010 (42)
- Visual C Sharp 2010 (65)
- WPF - Visual C# (20)
- Using SQL Server (1)
- Creating databases - overview (2)
- Simple Queries (5)
- Setting criteria using WHERE (4)
- Outputting to Excel (1)
- Calculations (4)
- Calculations using dates (3)
- Basic joins (6)
- More exotic joins (3)
- Aggregation and grouping (6)
- More complicated grouping (1)
- Views (6)
- Subqueries (2)
- Overview of functions (4)
- Overview of stored procedures (3)
- Detailed stored procedures (4)
- Variables (8)
- Parameters and return values (8)
- Testing conditions (1)
- Looping (1)
- Scalar functions (6)
- Transactions (4)
- Creating tables (3)
- Temporary tables and table variables (10)
- Table-valued functions (6)
- Derived tables and CTEs (7)
- Cursors (3)
- Error-handling (2)
- Dynamic SQL (2)
Exercise: Design a view, and change its function in script
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 Wise Owl course listed below!
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 above folder to generate the Doctor Who database.
Create a view by right-clicking on Views:
Right-click as shown to create a new view.
Include the tables tblAuthor, tblEpisode and tblDoctor, and use the view designer to create a view listing the episodes whose titles start with F, with the following information:
The 5 episodes starting with F, with their authors and doctors, sorted in date order.
Close this view down, saving it as vwEpisodesByFirstLetter.
You'll have to confirm at this stage that you want to add a TOP 100 PERCENT clause to the start of your view, so that sorting can be enabled.
Now right-click on your view and choose to script it:
Choose to alter the view.
Tidy up the SQL so that it's easier to read, and change the criteria to show episodes starting with H.
Run this script to alter your view, and then type in and execute this SQL to test it out:
-- show all of the H episodes
SELECT * FROM vwEpisodesByFirstLetter
You may need to press SHIFT + CTRL + R to refresh the local cache, to get Intellisense to detect the view name.
This should show two episodes:
The two episodes whose titles start with H.
Optionally, save your script as Initial episodes, then close it down (there's actually very little point saving the script, since the view has already been saved in your SQL Server database).