★ Pass on Your First TRY ★ 100% Money Back Guarantee ★ Realistic Practice Exam Questions

Free Instant Download NEW 70-461 Exam Dumps (PDF & VCE):
Available on: https://www.certleader.com/70-461-dumps.html


Q1. You use Microsoft SQL Server 2012 to write code for a transaction that contains several statements. 

There is high contention between readers and writers on several tables used by your transaction. 

You need to minimize the use of the tempdb space. You also need to prevent reading queries from blocking writing queries. 

Which isolation level should you use? 

A. SERIALIZABLE 

B. SNAPSHOT 

C. READ COMMITTED SNAPSHOT 

D. REPEATABLE READ 

Answer:


Q2. 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 person who placed the order. 

The solution must support the ANSI SQL-99 standard. 

Part of the correct T-SQL statement has been provided in the answer area. Provide the complete code. 

Answer: 

78. You are developing a database application by using Microsoft SQL Server 2012. 

An application that uses a database begins to run slowly. 

You discover that the root cause is a query against a frequently updated table that has a clustered index. The query returns four columns: three columns in its WHERE clause contained in a non-clustered index and one additional column. 

You need to optimize the statement. 

What should you do? 

A. Add a HASH hint lo the query. 

B. Add a LOOP hint to the query. 

C. Add a FORCESEEK hint to the query. 

D. Add an INCLUDE clause to the index. 

E. Add a FORCESCAN hint to the Attach query. 

F. Add a FORCESCAN hint to the Attach query. 

G. Add a columnstore index to cover the query. 

H. Enable the optimize for ad hoc workloads option. 

I. Cover the unique clustered index with a columnstore index. Include a SET FORCEPLAN ON statement before you run the query. 

J. Include a SET STATISTICS PROFILE ON statement before you run the query. 

K. Include a SET STATISTICS SHOWPLAN.XML ON statement before you run the query. 

L. Include a SET TRANSACTION ISOLATION LEVEL REPEATABLE READ statement before you run the query. 

M. Include a SET TRANSACTION ISOLATION LEVEL SNAPSHOT statement before you run the query. 

N. Include a SET TRANSACTION ISOLATION LEVEL SERIALIZABLE statement before you run the query. 

Answer:


Q3. 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. Use a user-defined table type. 

F. Use the VARBINARY data type. 

G. Use the DATETIME data type. 

H. Use the DATETIME2 data type. 

I. Use the DATETIMEOFFSET data type. 

J. Use the TODATETIMEOFFSET function. 

Answer:


Q4. CORRECT TEXT 

You need to create a query that calculates the total sales of each OrderlD from a table named Sales.Details. The table contains two columns named OrderlD and ExtendedAmount. 

The solution must meet the following requirements: 

Use one-part names to reference columns. 

Start the order of the results from OrderlD. 

NOT depend on the default schema of a user. 

Use an alias of TotalSales for the calculated ExtendedAmount. 

Display only the OrderlD column and the calculated TotalSales column. 

Provide the correct code in the answer area. 

Answer: 


Q5. You are a database developer for an application hosted on a Microsoft SQL Server 2012 server. 

The database contains two tables that have the following definitions: 

Global customers place orders from several countries. 

You need to view the country from which each customer has placed the most orders. 

Which Transact-SQL query do you use? 

A. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM Customer c INNER JOIN (SELECT CustomerID, ShippingCountry, RANK() OVER (PARTITION BY CustomerID ORDER BY COUNT(OrderAmount) DESC) AS Rnk FROM Orders GROUP BY CustomerID, ShippingCountry) AS o ON c.CustomerID = o.CustomerID WHERE o.Rnk = 1 

B. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM (SELECT c.CustomerID, c.CustomerName, o.ShippingCountry, RANK() OVER (PARTITION BY CustomerID ORDER BY COUNT(o.OrderAmount) ASC) AS Rnk FROM Customer c INNER JOIN Orders o ON c.CustomerID = o.CustomerID GROUP BY c.CustomerID, c.CustomerName, o.ShippingCountry) cs WHERE Rnk = 1 

C. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM Customer c INNER JOIN (SELECT CustomerID, ShippingCountry, RANK() OVER (PARTITION BY CustomerID ORDER BY OrderAmount DESC) AS Rnk FROM Orders GROUP BY CustomerID, ShippingCountry) AS o ON c.CustomerID = o.CustomerID WHERE o.Rnk = 1 

D. SELECT c.CustomerID, c.CustomerName, o.ShippingCountry FROM Customer c INNER JOIN (SELECT CustomerID, ShippingCountry, COUNT(OrderAmount) DESC) AS OrderAmount FROM Orders GROUP BY CustomerID, ShippingCountry) AS o ON c.CustomerID = o.CustomerID ORDER BY OrderAmount DESC 

Answer:


Q6. Your application contains a stored procedure for each country. Each stored procedure accepts an employee identification number through the @EmplD parameter. 

You need to build a single process for each employee that will execute the appropriate stored procedure based on the country of residence. 

Which approach should you use? 

A. A SELECT statement that includes CASE 

B. Cursor 

C. BULK INSERT 

D. View 

E. A user-defined function 

Answer:

Explanation: SQL Server user-defined functions are routines that accept parameters, perform an action, such as a complex calculation, and return the result of that action as a value. The return value can either be a single scalar value or a result set. 


Q7. You generate a daily report according to the following query: 

You need to improve the performance of the query. 

What should you do? 

A. Drop the UDF and rewrite the report query as follows: 

WITH cte(CustomerID, LastOrderDate) AS ( 

SELECT CustomerID, MAX(OrderDate) AS [LastOrderDate] 

FROM Sales.SalesOrder 

GROUP BY CustomerID 

SELECT c.CustomerName 

FROM cte 

INNER JOIN Sales.Customer c 

ON cte.CustomerID = c.CustomerID 

WHERE cte.LastOrderDate < DATEADD(DAY, -90, GETDATE()) 

B. Drop the UDF and rewrite the report query as follows: 

SELECT c.CustomerName 

FROM Sales.Customer c 

WHERE NOT EXISTS ( 

SELECT s.OrderDate 

FROM Sales.SalesOrder 

WHERE s.OrderDate > DATEADD(DAY, -90, GETDATE()) 

AND s.CustomerID = c.CustomerID) 

C. Drop the UDF and rewrite the report query as follows: 

SELECT DISTINCT c.CustomerName 

FROM Sales.Customer c 

INNER JOIN Sales.SalesOrder s 

ON c.CustomerID = s.CustomerID 

WHERE s.OrderDate < DATEADD(DAY, -90, GETDATE()) 

D. Rewrite the report query as follows: 

SELECT c.CustomerName 

FROM Sales.Customer c 

WHERE NOT EXISTS (SELECT OrderDate FROM 

Sales.ufnGetRecentOrders(c.CustomerID, 90)) 

Rewrite the UDF as follows: 

CREATE FUNCTION Sales.ufnGetRecentOrders(@CustomerID int, @MaxAge datetime) 

RETURNS TABLE AS RETURN ( 

SELECT OrderDate 

FROM Sales.SalesOrder 

WHERE s.CustomerID = @CustomerID 

AND s.OrderDate > DATEADD(DAY, -@MaxAge, GETDATE()) 

Answer:


Q8. You develop a Microsoft SQL Server 2012 database that contains a table named Customers. The Customers table has the following definition: 

You need to create an audit record only when either the MobileNumber or HomeNumber column is updated. 

Which Transact-SQL query should you use? 

A. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE AS IF COLUMNS_UPDATED (HomeNumber, MobileNumber) - - Create Audit Records 

B. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE AS IF EXISTS( SELECT HomeNumber FROM inserted) OR EXISTS (SELECT MobileNumber FROM inserted) - - Create Audit Records 

C. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE AS IF COLUMNS_CHANGED (HomeNumber, MobileNumber) - - Create Audit Records 

D. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE AS IF UPDATE (HomeNumber) OR UPDATE (MobileNumber) - - Create Audit Records 

Answer:


Q9. You administer a Microsoft SQL Server database named Sales. The database is 3 terabytes in size. The Sales database is configured as shown in the following table. 

You discover that Sales_2.ndf is corrupt. You need to recover the corrupted data in the minimum amount of time. What should you do? 

A. Perform a file restore. 

B. Perform a transaction log restore. 

C. Perform a restore from a full backup. 

D. Perform a filegroup restore. 

Answer:


Q10. You use a Microsoft SQL Server 2012 database. 

You want to create a table to store Microsoft Word documents. 

You need to ensure that the documents must only be accessible via Transact-SQL queries. 

Which Transact-SQL statement should you use? 

A. CREATE TABLE DocumentStore ( [Id] INT NOT NULL PRIMARY KEY, [Document] VARBINARY(MAX) NULL ) GO 

B. CREATE TABLE DocumentStore ( [Id] hierarchyid, [Document] NVARCHAR NOT NULL ) GO 

C. CREATE TABLE DocumentStore AS FileTable 

D. CREATE TABLE DocumentStore ( [Id] [uniqueidentifier] ROWGUIDCOL NOT NULL UNIQUE, [Document] VARBINARY(MAX) FILESTREAM NULL ) GO 

Answer: