E
Answers to Exercises
Chapter 3 Exercises
In the exercises for Chapters 3 and 4, I will provide numbered step-by-step instructions. The solutions for these chapters are the final query, commands, or result. In the exercises for subsequent chapters, I will provide less detailed instructions. You should use the material in each chapter to determine the appropriate steps and to find the solution.
Exercise 1
- Using Enterprise Manager or SQL Server Management Studio, create a new view in the AdventureWorks2000 database. You won't actually save the view but use this option to open the graphical query designer.
- Add the Product table to the designer.
- Select the ProductID, Name, and ListPrice columns by checking the corresponding boxes in the table window.
- Sort the results by the Name column in Ascending order using the Sort Type option.
- Check the SQL expression in the third pane of the graphical query designer with the solution.
Solution
The SQL Expression in the third pane of the graphical query designer should be as follows:
SELECT TOP 100 PERCENT ProductID, Name, ListPrice FROM dbo.Product ORDER BY Name
Exercise 2
- Using Enterprise Manager or SQL Server Management Studio, create a new view in the AdventureWorks2000 database as you did in Exercise 1.
- Add two tables: The Product table and the ProductSubCategory table.
- For the ProductSubCategory table, select the Name column and create an alias for it as SubCategory. For the Product table, select the Name column and create an alias ...
Get Beginning Transact-SQL with SQL Server 2000 and 2005 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.