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

Page: 1 / 14
Total 251 questions
Question 1

You administer a Microsoft SQL Server database that contains a table named Products.

In a bit column named Discontinued, a value of 1 indicates a product is inactive, and a value of 0 indicates the product is active.

You need to create a view that returns a column with a full product status description.

Which expression should you use to define the column?



Answer : B

The CASE statement evaluates a list of conditions and returns one of multiple possible result expressions.

The CASE expression has two formats:

The simple CASE expression compares an expression to a set of simple expressions to determine the result.

The searched CASE expression evaluates a set of Boolean expressions to determine the result.

Both formats support an optional ELSE argument.

CASE can be used in any statement or clause that allows a valid expression.

References: https://docs.microsoft.com/en-us/sql/t-sql/language-elements/case-transact-sql?view=sql-server-2017


Question 2

You develop a stored procedure for a wholesale glass manufacturing company. The stored procedure uses a cursor to read all row-based combinations of the following tables:

You observe that the stored procedure returns results very slowly.

You need to improve the execution speed of the stored procedure.

Which cursor type should you use?



Answer : B

FAST_FORWARD specifies a FORWARD_ONLY, READ_ONLY cursor with performance optimizations enabled.

References: https://msdn.microsoft.com/en-us/library/ms180169.aspx


Question 3

You need to build a table structure for a stored procedure to support data entry from a website form. The website form must meet the following requirements:

Which two actions should you perform? Each correct answer presents part of the solution.



Answer : D, E

SYSDATETIMEOFFSET returns a datetimeoffset(7) value that contains the date and time of the computer on which the instance of SQL Server is running.

ISDATE returns 1 if the expression is a valid date, time, or datetime value; otherwise, 0.

References:https://msdn.microsoft.com/en-us/library/bb677334.aspx


Question 4

You have a SQL Server database that contains all of the sales data for your company.

You need to create a query to update the rows in a table. The solution must write original and updated values to a separate table.

Which clause should you add to the UPDATE statement in the query?



Answer : D


Question 5

You are developing a database that will contain price information.

You need to store the prices that include a fixed precision and a scale of six digits.

Which data type should you use?



Answer : D

Numeric is the only one in the list that can give a fixed precision and scale.


Question 6

You need to create a query that meets the following requirements:

* The query must return a list of salespeople ranked by amount of sales and organized by postal code.

* The salesperson who has the highest amount of sales must be ranked first.

Part of the correct Transact-SQL has been provided in the answer area below. Enter the code in the answer area that resolves the problem and meets the stated goals or requirements. You can add code within 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 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 CustomerId value set to 1 in the following XML format.

Which Transact-SQL query should you use?



Page:    1 / 14   
Total 251 questions