Q1. You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.) You need to display rows from the Orders table for the Customers row having the CustomerIdvalue set to 1 in the following XML format. Which Transact-SQL query should you use? A. SELECT OrderId, OrderDate, Amount, Name, Country FROM Orders INNER…
Q1. CORRECT TEXT You have a view that was created by using the following code: You need to create an inline table-valued function named Sales.fn_OrdersByTerritory. Sales.fn_OrdersByTerritory must meet the following requirements: . Use one-part names to reference columns. . Return the columns in the same order as the order used in OrdersByTerritoryView. Part of the correct T-SQL statement has been provided in the answer area.…
Q1. CORRECT TEXT You have a database named Sales that contains the tables shown in the exhibit. (Click the Exhibit button). You need to create a query for a report. The query must meet the following requirements: NOT use object delimiters. Use the first initial of the table as an alias. Return the most recent order date for each customer. Retrieve the last name of the…
Q1. CORRECT TEXT You have a database that contains the tables shown in the exhibit. (Click the Exhibit button). You need to create a query for a report. The query must meet the following requirements: NOT use object delimiters. Return the most recent orders first. Use the first initial of the table as an alias. Return the most recent order date for each customer. Retrieve the last…
Q1. You develop a database for a travel application. You need to design tables and other database objects. You create a stored procedure. You need to supply the stored procedure with multiple event names and their dates as parameters. What should you do? A. Use the CAST function. B. Use the DATE data type. C. Use the FORMAT function. D. Use an appropriate collation. E.…
Q1. Your database contains a table named Purchases. The table includes a DATETIME column named PurchaseTime that stores the date and time each purchase is made. There is a non-clustered index on the PurchaseTime column. The business team wants a report that displays the total number of purchases made on the current day. You need to write a query that will return…
Q1. CORRECT TEXT You have a database named Sales that contains the tables as shown in the exhibit. (Click the Exhibit button.) You need to create a query that meets the following requirements: References columns by using one-part names only. Groups aggregates by SalesTerritorylD, and then by ProductlD. Orders the results in descending order by SalesTerritorylD and then by ProductlD. Part of the correct T-SQL statement has…
Q1. You administer a Microsoft SQL Server database that supports a shopping application. You need to retrieve a list of customers who live in territories that do not have a sales person. Which Transact- SQL query or queries should you use? (Each correct answer presents a complete solution. Choose all that apply.) A. SELECT CustomerID FROM Customer WHERE TerritoryID SOME(SELECT TerritoryID FROM Salesperson) B. SELECT…
Q1. Your database contains a table named SalesOrders. The table includes a DATETIME column named OrderTime that stores the date and time each order is placed. There is a non-clustered index on the OrderTime column. The business team wants a report that displays the total number of orders placed on the current day. You need to write a query that will return…
Q1. You use Microsoft SQL Server 2012 to create a stored procedure as shown in the following code segment. (Line numbers are included for reference only.) The procedure can be called within other transactions. You need to ensure that when the DELETE statement from the HumanResourcesJobCandidate table succeeds, the modification is retained even if the insert into the Audit.Log table fails. Which code…
Q1. A table named Profits stores the total profit made each year within a territory. The Profits table has columns named Territory, Year, and Profit. You need to create a report that displays the profits made by each territory for each year and its previous year. Which Transact-SQL query should you use? A. SELECT Territory, Year, Profit, LEAD(Profit, 1, 0) OVER (PARTITION BY…
Q1. You are developing a database application by using Microsoft SQL Server 2012. You have a query that runs slower than expected. You need to capture execution plans that will include detailed information on missing indexes recommended by the query optimizer. What should you do? A. Add a HASH hint to the query. B. Add a LOOP hint to the query. C. Add a FORCESEEK…
Q1. CORRECT TEXT You have a database named Sales that contains the tables shown in the exhibit. (Click the Exhibit button.) You have an application named Appl. You have a parameter named @Count that uses the int data type. App1 is configured to pass @Count to a stored procedure. You need to create a stored procedure named usp_Customers for App1 that returns only the number…
Q1. You develop a database application. You create four tables. Each table stores different categories of products. You create a Primary Key field on each table. You need to ensure that the following requirements are met: The fields must use the minimum amount of space. The fields must be an incrementing series of values. The values must be unique among the four tables. What should you…
Q1. DRAG DROP You develop a database application for a university. You need to create a view that will be indexed that meets the following requirements: . Displays the details of only students from Canada. . Allows insertion of details of only students from Canada. Which four Transact-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements…