APPENDIX

Answers to Exercises

This appendix provides the solutions for the end-of-chapter exercises located in Chapters 1–21.

CHAPTER 1

Answer to Question 1

The master database contains system tables that keep track of all the objects in the system, including the master database itself.

Answer to Question 2

datetime stores times to a precision of 3/100 sec and fits into eight bytes. datetime2 stores times in anywhere from seconds (datetime2(0)) to 100 nanoseconds (datetime2(7)), and takes from six to eight bytes.

CHAPTER 2

Answer to Question 1

Reporting Services, Analysis Services, and Integration Services all have their programming interface in SSDT. If you have the full version of Visual Studio, the SQL 2012 development tools also permit T-SQL development there.

Answer to Question 2

You can see the predicted plan using the Show Estimated Execution Plan button or menu item. To see the actual plan, use Show Actual Execution Plan, and then run the query.

CHAPTER 3

Answer to Question 1

SELECT * FROM Production.Product

Answer to Question 2

SELECT * FROM Production.Product WHERE ProductSubcategoryID IS NULL

Answer to Question 3

INSERT INTO Production.Location 
    (Name, CostRate, Availability, ModifiedDate)
VALUES ('Test', 0.00, 0.00, '20110901')

Answer to Question 4

DELETE Production.Location WHERE Name = 'Test'

CHAPTER 4

Answer to Question 1

SELECT P.LastName AS Name FROM Person.Person P JOIN HumanResources.Employee E ON P.BusinessEntityID = E.BusinessEntityID WHERE E.NationalIDNumber ...

Get Beginning Microsoft® SQL Server® 2012 Programming now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.