1.
You have two tables named dbo.Products and dbo.PriceChange. Table dbo.Products contains ten products. Five products are priced at $20 per unit and have PriceIncrease set to 1. The other five products are priced at $10 per unit and have PriceIncrease set to 0. You have the following query: INSERT dbo.PriceChange (ProductID, Change, ChangeDate) SELECT ProductID, inPrice - delPrice, SYSDATETIME() FROM ( UPDATE dbo.Products SET Price *= 1.1 OUTPUT inserted.ProductID, inserted.Price, deleted.Price WHERE PriceIncrease = 1) p (ProductID, inPrice, delPrice); You need to predict the results of the query. Which results should the query produce?
2.
You are tasked to create a table that has a column that must store the current time accurate to ten microseconds. You need to use a system function in conjunction with the DEFAULT option in the column definition. Which system function should you use?
3.
You have two tables named SalesPerson and SalesTerritory. You need to create sample data by using a Cartesian product that contains the data from the SalesPerson and SalesTerritory tables. Which code segment should you use?
4.
You are given a database design to evaluate. All of the tables in this database should have a clustered index. You need to determine the tables that are missing a clustered index by using the system catalog views. Which Transact-SQL statement should you use?
5.
You work for an international charity organization. You are writing a query to list the highest 100 different amounts that were donated. You have written the following code segment: 01 SELECT * 02 FROM (SELECT Customer.CustomerID, SUM(TotalDue) AS TotalGiven, 03 04 FROM Customer 05 JOIN SalesOrder 06 ON Customer.CustomerID = SalesOrder.CustomerID 07 GROUP BY Customer.CustomerID) AS DonationsToFilter 08 WHERE FilterCriteria <= 100 You need to insert a Transact-SQL clause in line 03 to complete the query. Which Transact-SQL clause should you insert?
6.
You have a table named Books that has columns named BookTitle and Description. There is a full-text index on these columns. You need to return rows from the table in which the word 'computer' exists in either column. Which code segment should you use?
7.
A table named Locations contains 5000 locations and the number of sales made at each location. You need to display the top 5 percent of locations by sales made. Which Transact-SQL code segment should you use?
8.
Your company manufactures and distributes bowling balls. You have a full-text catalog named ftCatalog which contains the ftInventory index on the Products table. Your marketing department has just inserted a new bowling ball into the Inventory table. You notice only the new bowling ball is not being included in the results of the full-text searches. You have confirmed that the row exists in the Products table. You need to update the full-text catalog in the least amount of time. Which Transact-SQL statement should you use?
9.
You have the following two tables. Products ProductID ProductName VendorID 1 Product1 0 2 Product2 1 3 Product3 1 4 Product4 0 ProductChanges ProductID ProductName VendorID 1 Product1 1 2 Product2 1 3 NewProduct3 2 5 Product5 1 You execute the following statement. MERGE Products USING ProductChanges ON (Products.ProductID = ProductChanges.ProductID) WHEN MATCHED AND Products.VendorID = 0 THEN DELETE WHEN MATCHED THEN UPDATE SET Products.ProductName = ProductChanges.ProductName, Products.VendorID = ProductChanges.VendorID; You need to identify the rows that will be displayed in the Products table. Which rows will be displayed?
10.
You have a database that contains two tables named ProductCategory and ProductSubCategory. You need to write a query that returns a list of product categories that contain more than ten sub-categories. Which query should you use?