Microsoft 70-461 Querying Microsoft SQL Server 2012/2014 Exam Practice Test

Page: 1 / 14
Total 251 questions
Question 1

You administer a database that includes a table named Customers that contains more than 750 rows. You create a new column named PartitionNumber of the int type in the table.

You need to assign a PartitionNumber for each record in the Customers table. You also need to ensure that the PartitionNumber satisfies the following conditions:

* Always starts with 1.

* Starts again from 1 after it reaches 100.

Which Transact-SQL statement should you use?



Question 2

You develop a Microsoft SQL Server 2012 database.

You need to create and call a stored procedure that meets the following requirements:

* Accepts a single input parameter for CustomerID.

* Returns a single integer to the calling application.

Which Transact-SQL statement or statements should you use? (Each correct answer presents part of the solution. Choose all that apply.)



Answer : A, E


Question 3

You have a database that contains the tables shown in the exhibit. (Click the Exhibit button.)

You deploy a new server that has SQL Server 2012 installed. You need to create a table named

Sales.OrderDetails on the new server. Sales.OrderDetails must meet the following requirements:

* Write the results to a disk.

* Contain a new column named LineItemTotal that stores the product of ListPrice and Quantity for each row.

* The code must NOT use any object delimiters.

The solution must ensure that LineItemTotal is stored as the last column in the table. Which code segment should you use?



Question 4

You have a vendor application that uses a scalar function.

You discover that the queries for the application run slower than expected.

You need to gather the runtime information of the scalar function.

What are two possible ways to achieve this goal? Each correct answer presents a complete solution.



Answer : A, D

A: An execution plan is the result of the query optimizer's attempt to calculate the mostefficient way to implement the request represented by the T-SQL query you submitted. To generate the first execution plan, you can enable the Include Actual Execution Plan option.

D: SQL Server Extended Events can be used to capture User Defined Function(UDF) counts

References:https://www.mssqltips.com/sqlservertip/4100/how-to-find-udfs-causing-sql-server-performance-issues/


Question 5

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?



Answer : C


Question 6

You need to execute an UPDATE statement that modifies a subset of rows in a table. The rows affected by the UPDATE statement must only be committed if the row count criteria is met.

Part of the correct Transact-SQL has been provided in the answer are below. Enter the code in the answer area that resolves the problem and meets the stated goals or requirements. You can add code within the code that has been provided as well as below it.

Use the 'Check Syntax' button to verify your work. Any syntax or spelling errors will be reported by line and character position.



Question 7

You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50 students for various subjects.

You need to ensure that the following requirements are met:

* Students must be ranked based on their average marks.

* If one or more students have the same average, the same rank must be given to these students.

* Ranks must be sequential without gaps in between.

Which Transact-SQL query should you use?



Answer : B

The DENSE_RANK function returns the rank of each row within a result set partition, with no gaps in the ranking values. The rank of a specific row is one plus the number of distinct rank values that come before that specific row.

References: https://docs.microsoft.com/en-us/sql/t-sql/functions/dense-rank-transact-sql?view=sql-server-2017


Page:    1 / 14   
Total 251 questions