70-461 microsoft - gratis exam · 70-461 microsoft number : 70-461 passing score : 700 time limit...

269
http://www.gratisexam.com/ 70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min http://www.gratisexam.com/

Upload: truongtu

Post on 21-Aug-2018

228 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

70-461 microsoft

Number: 70-461Passing Score: 700Time Limit: 120 min

http://www.gratisexam.com/

Page 2: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Exam A

QUESTION 1You develop a Microsoft SQL Server 2012 server database that supports an application. The application contains a table that has the following definition:

CREATE TABLE Inventory(ItemID int NOT NULL PRIMARY KEY,ItemsInStore int NOT NULL,ItemsInWarehouse int NOT NULL)

You need to create a computed column that returns the sum total of the ItemsInStore and ItemsInWarehouse values for each row. Which Transact-SQL statementshould you use?

A. ALTER TABLE InventoryADD TotalItems AS ItemsInStore + ItemsInWarehouse

B. ALTER TABLE InventoryADD ItemsInStore - ItemsInWarehouse = TotalItems

C. ALTER TABLE InventoryADD TotalItems = ItemsInStore + ItemsInWarehouse

D. ALTER TABLE InventoryADD TotalItems AS SUM(ItemsInStore, ItemslnWarehouse);

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://technet.microsoft.com/en-us/library/ms190273.aspx

QUESTION 2

You develop a Microsoft SQL Server 2012 database. You create a view from the Orders and OrderDetails tables by using the following definition. You need toimprove the performance of the view by persisting data to disk. What should you do?

Page 3: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://www.gratisexam.com/

A. Create an INSTEAD OF trigger on the view.

B. Create an AFTER trigger on the view.

C. Modify the view to use the WITH VIEW_METADATA clause.

D. Create a clustered index on the view.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms188783.aspx

QUESTION 3You develop a database for a travel application. You need to design tables and other database objects. You create the Airline_Schedules table. You need to storethe departure and arrival dates and times of flights along with time zone information. What should you do?

A. Use the CAST function.

B. Use the DATE data type.

C. Use the FORMAT function.

Page 4: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

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.

Correct Answer: ISection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ff848733.aspxhttp://msdn.microsoft.com/en-us/library/bb630289.aspx

QUESTION 4You 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 thestored 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.

Correct Answer: ESection: (none)Explanation

Explanation/Reference:

Page 5: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 5CORRECT TEXTYou 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 namedSales.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.

Page 6: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

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

To answer, type the correct code in the answer area.

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:CREATE TABLE Sales.OrderDetails (ListPrice money not null,Quantity int not null,LineItemTotal as (ListPrice * Quantity) PERSISTED)

Explanation:Reference: http://msdn.microsoft.com/en-us/library/ms174979.aspx Reference: http://technet.microsoft.com/en-us/library/ms188300.aspx

QUESTION 6CORRECT TEXTYou have a database that contains the tables shown in the exhibit. (Click the Exhibit button.)

Page 7: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to create a view named uv_CustomerFullName to meet the following requirements:The code must NOT include object delimiters.The view must be created in the Sales schema.Columns must only be referenced by using one-part names.The view must return the first name and the last name of all customers.The view must prevent the underlying structure of the customer table from being changed.The view must be able to resolve all referenced objects, regardless of the user's default schema.

Which code segment should you use?To answer, type the correct code in the answer area.

Page 8: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:CREATE VIEW Sales.uv_CustomerFullNameWITH SCHEMABINDINGASSELECT FirstName, LastNameFROM Sales.Customers

Explanation:Reference: http://msdn.microsoft.com/en-us/library/ms187956.aspx

QUESTION 7CORRECT TEXTYou have a database that contains the tables shown in the exhibit. (Click the Exhibit button.)

Page 9: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to create a query that calculates the total sales of each OrderId from the Sales.Details table. The solution must meet the following requirements:Use one-part names to reference columns.Sort the order of the results from OrderId.NOT depend on the default schema of a user.Use an alias of TotalSales for the calculated ExtendedAmount.Display only the OrderId column and the calculated TotalSales column.

Which code segment should you use?To answer, type the correct code in the answer area.

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:

Page 10: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation:SELECT OrderID, SUM(ExtendedAmount) AS TotalSalesFROM Sales.DetailsGROUP BY OrderIDORDER BY OrderID

QUESTION 8CORRECT TEXTYou 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:Accept the @T integer parameter Use one-part names to reference columns.Filter the query results by SalesTerritoryID.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. Provide the complete code.

key words

Page 11: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:

Page 12: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

CREATE FUNCTION Sales.fn_OrdersByTerritory (@T int)RETURNS TABLEASRETURN(SELECT OrderID, OrderDate, SalesTerritoryID, TotalDueFROM Sales.OrdersByTerritoryWHERE SalesTerritoryID=@T)

QUESTION 9You have a Microsoft SQL Server 2012 database that contains tables named Customers and Orders. The tables are related by a column named CustomerID. Youneed to create a query that meets the following requirements:- Returns the CustomerName for all customers and the OrderDate for any orders that they have placed.- Results must include customers who have not placed any orders.Which Transact-SQL query should you use?

A. SELECT CustomerName, OrderDateFROM Customers RIGHT OUTER JOIN OrdersON Customers.CustomerID = Orders.CustomerID

B. SELECT CustomerName, CrderDateFROM Customers JOIN OrdersON Customers.CustomerID = Orders.CustomerID

C. SELECT CustomerName, OrderDateFROM Customers CROSS JOIN OrdersON Customers.CustomerID = Orders.CustomerID

D. SELECT CustomerName, OrderDateFROM Customers LEFT OUTER JOIN OrdersON Customers.CustomerID = Orders.CustomerID

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms177634.aspx

Page 13: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 10You create a stored procedure that will update multiple tables within a transaction. You need to ensure that if the stored procedure raises a run-time error, the entiretransaction is terminated and rolled back. Which Transact-SQL statement should you include at the beginning of the stored procedure?

A. SET XACT_ABORT ON

B. SET ARITHABORT ON

C. TRY

D. BEGIN

E. SET ARITHABORT OFF

F. SET XACT_ABORT OFF

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms190306.aspxhttp://msdn.microsoft.com/en-us/library/ms188792.aspx

QUESTION 11Your database contains two tables named DomesticSalesOrders and InternationalSalesOrders. Both tables contain more than 100 million rows. Each table has aPrimary Key column named SalesOrderId. The data in the two tables is distinct from one another. Business users want a report that includes aggregate informationabout the total number of global sales and total sales amounts. You need to ensure that your query executes in the minimum possible time. Which query should youuse?

A. SELECT COUNT(*) ASNumberOfSales,SUM(SalesAmount) ASTotalSalesAmountFROM (SELECT SalesOrderId, SalesAmountFROMDomesticSalesOrdersUNION ALL SELECTSalesOrderId,SalesAmountFROMInternationalSalesOrder s ) AS p

B. SELECT COUNT(*) ASNumberOfSales,SUM(SalesAmount) AS

Page 14: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

TotalSalesAmountFROM (SELECT SalesOrderId, SalesAmountFROMDomesticSalesOrdersUNION SELECTSalesOrderId,SalesAmountFROMInternationalSalesOrder s ) AS p

C. SELECT COUNT(*) ASNumberOfSales,SUM(SalesAmount) ASTotalSalesAmountFROM DomesticSalesOrdersUNION SELECT COUNT(*) ASNumberOfSales,SUM(SalesAmount) ASTotalSalesAmountFROM InternationalSalesOrders

D. SELECT COUNT(*) ASNumberOfSales,SUM(SalesAmount) ASTotalSalesAmountFROM DomesticSalesOrdersUNION ALL SELECT COUNT(*) AS NumberOfSales,SUM(SalesAmount) ASTotalSalesAmountFROM InternationalSalesOrders

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms180026.aspxhttp://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs-union-all-optimal- performance-comparison/

QUESTION 12You are a database developer at an independent software vendor. You create stored procedures that contain proprietary code. You need to protect the code frombeing viewed by your customers.Which stored procedure option should you use?

Page 15: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://www.gratisexam.com/

A. ENCRYPTBYKEY

B. ENCRYPTION

C. ENCRYPTBYPASSPHRASE

D. ENCRYPTBYCERT

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:http://technet.microsoft.com/en-us/library/bb510663.aspxhttp://technet.microsoft.com/en-us/library/ms174361.aspxhttp://msdn.microsoft.com/en-us/library/ms187926.aspxhttp://technet.microsoft.com/en-us/library/ms190357.aspxhttp://technet.microsoft.com/en-us/library/ms188061.aspx

QUESTION 13You 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 onlybe 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

Page 16: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

)GO

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/gg471497.aspxhttp://msdn.microsoft.com/en-us/library/ff929144.aspx

QUESTION 14You develop a Microsoft SQL Server 2012 database. The database is used by two web applications that access a table named Products. You want to create anobject that will prevent the applications from accessing the table directly while still providing access to the required data. You need to ensure that the followingrequirements are met:

- Future modifications to the table definition will not affect the applications' ability to access data.- The new object can accommodate data retrieval and data modification.- You need to achieve this goal by using the minimum amount of changes to the existing applications.What should you create for each application?

A. views

B. table partitions

C. table-valued functions

D. stored procedures

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 15You develop a Microsoft SQL Server 2012 database. You need to create a batch process that meets the following requirements:- Returns a result set based on supplied parameters.- Enables the returned result set to perform a join with a table.Which object should you use?

Page 17: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Inline user-defined function

B. Stored procedure

C. Table-valued user-defined function

D. Scalar user-defined function

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 16You 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.)

Page 18: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 19: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

D. Option D

E. Option E

F. Option F

Correct Answer: CFSection: (none)Explanation

Explanation/Reference:

QUESTION 17You develop a Microsoft SQL Server 2012 database that contains a heap named OrdersHistoncal.You write the following Transact-SQL query:INSERT INTO OrdersHistorical SELECT * FROM CompletedOrdersYou need to optimize transaction logging and locking for the statement. Which table hint should you use?

A. HOLDLOCK

B. ROWLOCK

C. XLOCK

D. UPDLOCK

E. TABLOCK

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:http://technet.microsoft.com/en-us/library/ms189857.aspxhttp://msdn.microsoft.com/en-us/library/ms187373.aspx

QUESTION 18You use a Microsoft SQL Server 2012 database that contains two tables named SalesOrderHeader and SalesOrderDetail. The indexes on the tables are as shownin the exhibit.

Page 20: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You write the following Transact-SQL query:

You discover that the performance of the query is slow. Analysis of the query plan shows table scans where the estimated rows do not match the actual rows forSalesOrderHeader by using an unexpected index on SalesOrderDetail. You need to improve the performance of the query. What should you do?

Page 21: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Use a FORCESCAN hint in the query.

B. Add a clustered index on SalesOrderId in SalesOrderHeader.

C. Use a FORCESEEK hint in the query.

D. Update statistics on SalesOrderId on both tables.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms187348.aspx

QUESTION 19Your database contains a table named Purchases. The table includes a DATETIME column named PurchaseTime that stores the date and time each purchase ismade. 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 thecurrent day. You need to write a query that will return the correct results in the most efficient manner. Which Transact-SQL query should you use?

A. SELECT COUNT(*)FROMPurchases WHEREPurchaseTime =CONVERT(DATE, GETDATE())

B. SELECT COUNT(*)FROMPurchases WHEREPurchaseTime = GETDATE()

C. SELECT COUNT(*)FROMPurchases WHERECONVERT(VARCHAR,PurchaseTime, 112) = CONVERT(VARCHAR, GETDATE(), 112)

D. SELECT COUNT(*)FROMPurchases WHEREPurchaseTime >=CONVERT(DATE, GETDATE()) AND PurchaseTime <DATEADD(DAY, 1,CONVERT(DATE,GETDATE()))

Correct Answer: DSection: (none)Explanation

Page 22: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:http://technet.microsoft.com/en-us/libr ary/ms181034.aspx

QUESTION 20You develop a database for a travel application. You need to design tables and other database objects. You need to store media files in several tables. Each mediafile is less than 1MB in size. The media files will require fast access and will be retrieved frequently. 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.

Correct Answer: FSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms188362.aspx

QUESTION 21You develop a database for a travel application. You need to design tables and other database objects. You create a view that displays the dates and times of theairline schedules on a report.You need to display dates and times in several international formats. 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.

Page 23: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

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.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/hh213505.aspx

QUESTION 22You are a database developer of a Microsoft SQL Server 2012 database. You are designing a table that will store Customer data from different sources. The tablewill include a column that contains the CustomerID from the source system and a column that contains the SourceID. A sample of this data is as shown in thefollowing table. You need to ensure that the table has no duplicate CustomerID within a SourceID. You also need to ensure that the data in the table is in the orderof SourceID and then CustomerID. Which Transact- SQL statement should you use?

A. CREATE TABLE Customer(SourceID int NOT NULL IDENTITY,CustomerID int NOT NULL IDENTITY,CustomerName varchar(255) NOT NULL);

B. CREATE TABLE Customer(SourceID int NOT NULL,CustomerID int NOT NULL PRIMARY KEY CLUSTERED,CustomerName varchar(255) NOT NULL);

C. CREATE TABLE Customer

Page 24: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

(SourceID int NOT NULL PRIMARY KEY CLUSTERED,CustomerID int NOT NULL UNIQUE,CustomerName varchar(255) NOT NULL);

D. CREATE TABLE Customer(SourceID int NOT NULL,CustomerID int NOT NULL,CustomerName varchar(255) NOT NULL,CONSTRAINT PK_Customer PRIMARY KEY CLUSTERED(SourceID, CustomerID));

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 23You develop a Microsoft SQL Server 2012 database that contains tables named Employee and Person. The tables have the following definitions:

Page 25: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You create a view named VwEmployee as shown in the following Transact-SQL statement.

Users are able to use single INSERT statements or INSERT...SELECT statements into this view. You need to create an audit record only when either the RetailPrice to insert records into both Employee and Person tables by using the VwEmployee view. Which Transact-SQL statement should you use?

Page 26: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 27: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

D. Option D

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 24You develop a Microsoft SQL Server 2012 database that contains a table named Products. The Products table has the following definition. You need to create anaudit record only when either the RetailPrice or WholeSalePrice column is updated. Which Transact-SQL query should you use?

http://www.gratisexam.com/

A. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE ASIF CCLUMNS_CHANGED(RetailPrice, WholesalePrice)- - Create Audit Records

B. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS

Page 28: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

IF EXISTS(SELECT RetailPrice from inserted) OREXISTS (SELECT WholeSalePnce FROM inserted)- - Create Audit Records

C. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE ASIF COLUMNS_UPDATED(RetailPrice, WholesalePrice)- - Create Audit Records

D. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE ASIF UPDATE(RetailPrice) OR UPDATE(WholeSalePrice)- - Create Audit Records

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/bb510663.aspxhttp://msdn.microsoft.com/en-us/library/ms186329.aspx

QUESTION 25You have three tables that contain data for vendors, customers, and agents. You create a view that is used to look up telephone numbers for these companies. Theview has the following definition. You need to ensure that users can update only the phone numbers by using this view. What should you do?

Page 29: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Alter the view.Use the EXPAND VIEWS query hint along with each SELECT statement.

B. Drop the view.Re-create the view by using the SCHEMABINDING clause, and then create an index on the view.

C. Create an AFTER UPDATE trigger on the view.

D. Create an INSTEAD OF UPDATE trigger on the view.

Page 30: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms187956.aspx

QUESTION 26You use Microsoft SQL Server 2012 database to develop a shopping cart application. You need to rotate the unique values of the ProductName field of a table-valued expression into multiple columns in the output. Which Transact-SQL operator should you use?

A. CROSS JOIN

B. CROSS APPLY

C. PIVOT

D. UNPIVOT

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:http://technet.microsoft.com/en-us/library/ms177634.aspx

QUESTION 27You 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 nothave 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 CustomerWHERE TerritoryID <> SOME(SELECT TerritoryIDFROM Salesperson)

B. SELECT CustomerID FROM CustomerWHERE TerritoryID <> ALL(SELECT TerritoryIDFROM Salesperson)

C. SELECT CustomerID FROM CustomerWHERE TerritoryID <> ANY(SELECT TerritoryIDFROM Salesperson)

D. SELECT CustomerID FROM CustomerWHERE TerritoryID NOT IN(SELECT TerritoryID FROM Salesperson)

Page 31: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:

QUESTION 28You support a database structure shown in the exhibit.

You need to write a query that displays the following details:- Total sales made by sales people, year, city, and country.- Sub totals only at the city level and country level.- A grand total of the sales amount.Which Transact-SQL query should you use?

Page 32: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

D. Option D

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:The question about BlogEntry is wrong. We need to "append" the text, with the query proposal in the answer, we overwrite the whole string. The correct answer tothis question is C. http://www.grapefruitmoon.net/diving-into-t-sql-grouping-sets/ http://msdn.microsoft.com/en-us/library/ms177673.aspx

QUESTION 29You administer a Microsoft SQL Server database that supports a banking transaction management application. You need to retrieve a list of account holders wholive in cities that do not have a branch location. Which Transact-SQL query or queries should you use? (Each correct answer presents a complete solution. Choose

Page 33: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

all that apply.)

A. SELECT AccountHolderIDFROM AccountHolderWHERE CityID NOT IN (SELECT CityID FROM BranchMaster)

B. SELECT AccountHolderIDFROM AccountHolderWHERE CityID <> ALL (SELECT CityID FROM BranchMaster)

C. SELECT AccountHolderlDFROM AccountHolderWHERE CityID <> SOME (SELECT CityID FROM BranchMaster)

D. SELECT AccountHolderIDFROM AccountHolderWHERE CityID <> ANY (SELECT CityID FROM BranchMaster)

Correct Answer: ABSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms188047.aspxhttp://msdn.microsoft.com/en-us/library/ms177682.aspxhttp://msdn.microsoft.com/en-us/library/ms173545.aspx

QUESTION 30You administer a Microsoft SQL Server 2012 database. The database contains a table named Employee. Part of the Employee table is shown in the exhibit.

Page 34: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 35: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Confidential information about the employees is stored in a separate table named EmployeeData. One record exists within EmployeeData for each record in theEmployee table. You need to assign the appropriate constraints and table properties to ensure data integrity and visibility. On which column in the Employee tableshould you a create a unique constraint?

A. DateHired

B. DepartmentID

C. EmployeelD

D. EmployeeNum

E. FirstName

F. JobTitle

Page 36: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

G. LastName

H. MiddleName

I. ReportsToID

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 31You 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 datatype should you use?

A. Float

B. Money

C. Smallmoney

D. Numeric

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:Numeric is the only one in the list that can give a fixed precision and scale.http://msdn.microsoft.com/en-us/library/ms179882.aspx

QUESTION 32You administer a Microsoft SQL Server 2012 database. The database contains a table named Employee. Part of the Employee table is shown in the exhibit.

Page 37: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 38: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 39: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Confidential information about the employees is stored in a separate table named EmployeeData. One record exists within EmployeeData for each record in theEmployee table. You need to assign the appropriate constraints and table properties to ensure data integrity and visibility. On which column in the Employee tableshould you use an identity specification to include a seed of 1,000 and an increment of 1?

A. DateHired

B. DepartmentID

C. EmployeeID

D. EmployeeNum

E. FirstName

F. JobTitle

G. LastName

H. MiddleName

I. ReportsToID

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 33You administer a Microsoft SQL Server 2012 database that includes a table named Products. The Products table has columns named Productld, ProductName, andCreatedDateTime. The table contains a unique constraint on the combination of ProductName and CreatedDateTime. You need to modify the Products table tomeet the following requirements:- Remove all duplicates of the Products table based on the ProductName column.

- Retain only the newest Products row.Which Transact-SQL query should you use?

A. WITH CTEDupRecordsAS(SELECT MAX(CreatedDateTime) AS CreatedDateTime, ProductName FROM ProductsGROUP BY ProductNameHAVING COUNT(*) > 1)DELETE pFROM Products pJOIN CTEDupRecords cte ON ProductName = cte.ProductName

Page 40: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

AND p.CreatedDateTime > cte.CreatedDateTime

B. WITH CTEDupRecordsAS(SELECT MAX(CreatedDateTime) AS CreatedDateTime, ProductName FROM ProductsGROUP BY ProductNameHAVING COUNT(*) > 1)DELETE pFROM Products pJOIN CTEDupRecords cte ONcte.ProductName = p.ProductNameAND cte.CreatedDateTime > p.CreatedDateTime

C. WITH CTEDupRecordsAS(SELECT MIN(CreatedDateTime) AS CreatedDateTime, ProductName FROM ProductsGROUP BY ProductName)DELETE pFROM Products pJOIN CTEDupRecords cte ON ProductName = cte.ProductName

D. WITH CTEDupRecordsAS(SELECT MAX(CreatedDateTime) AS CreatedDateTime, ProductName FROM ProductsGROUP BY ProductNameHAVING COUNT(*) > 1)DELETE pFROM Products pJOIN CTEDupRecords cte ON ProductName = cte.ProductName

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

Page 41: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 34You develop three Microsoft SQL Server 2012 databases named Database1, Database2, and Database3. You have permissions on both Database1 andDatabase2. You plan to write and deploy a stored procedure named dbo.usp_InsertEvent in Database3. dbo.usp_InsertEvent must execute other stored proceduresin the other databases. You need to ensure that callers that do not have permissions on Database1 or Database2 can execute the stored procedure. WhichTransact-SQL statement should you use?

A. USE Database2

B. EXECUTE AS OWNER

C. USE Database1

D. EXECUTE AS CALLER

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms188354.aspxhttp://blog.sqlauthority.com/2007/10/06/sql-server-executing-remote-stored-procedure-calling- stored-procedure-on-linked-server/

QUESTION 35You generate a daily report according to the following query:

Page 42: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to improve the performance of the query. What should you do?

Page 43: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 44: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

D. Option D

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 36You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.

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:<row OrderId="1" OrderDate="2000-01-01T00:00 :00" Amount="3400.00" Name="Customer A" Country="Australia" /><row OrderId="2" OrderDate="2001-01-01T00:00 :00" Amount="4300.00" Name="Customer A" Country="Australia" />

Which Transact-SQL query should you use?

A. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW

B. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW, ELEMENTS

Page 45: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML AUTO

D. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId - Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

E. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId=Customers.CustomerIdWHERE Customers.CustomerId- 1FOR XML AUTO

F. SELECT Name, Country, Orderld, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId=Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

G. SELECT Name AS '@Name', CountryAS '@Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

H. SELECT Name AS 'Customers/Name', CountryAS 'Customers/Country', OrderId,OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/bb510464.aspx

Page 46: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 37CORRECT TEXTYou 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 only by SalesTerritoryID, and then by ProductID.Orders the results in descending order by SalesTerritoryID and then by ProductID in descending order for both.

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

Page 47: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:SELECT SalesTerritoryID, ProductID, AVG(UnitPrice), MAX(OrderQty) MAX(DiscountAmount)FROM Sales.DetailsGROUP BY SalesTerritoryID, ProductIDORDER BY SalesTerritoryID DESC, ProductID DESC

QUESTION 38CORRECT TEXTYou have an XML schema collection named Sales.InvoiceSchema.

You need to declare a variable of the XML type named XML1. The solution must ensure that XML1 is validated by using Sales.InvoiceSchema.

Which code segment should you use?To answer, type the correct code in the answer area.

Correct Answer: DECLARE @XML1 XML(Sales.InvoiceSchema)Section: (none)Explanation

Explanation/Reference:Explanation:Reference: http://msdn.microsoft.com/en-us/library/ms176009.aspx

QUESTION 39CORRECT TEXTYou have a database named Sales that contains the tables shown in the exhibit. (Click the Exhibit button).

Page 48: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

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.

Page 49: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:SELECT C.LastName,MAX(O.OrderDate) AS MostRecentOrderDateFROM Customers AS C INNER JOIN Orders AS OON C.CustomerID=O.CustomerIDGROUP BY C.LastnameORDER BY MAX (O.OrderDate) DESC

QUESTION 40CORRECT TEXTYou have a database named Sales that contains the tables as shown in the exhibit. (Click the Exhibit button.)

Page 50: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to create a query that returns a list of products from Sales.ProductCatalog. The solution must meet the following requirements:UnitPrice must be returned in descending order.The query must use two-part names to reference the table.The query must use the RANK function to calculate the results.The query must return the ranking of rows in a column named PriceRank.The list must display the columns in the order that they are defined in the table. PriceRank must appear last.

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

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:SELECT ProductCatalog.CatID, ProductCatalog.CatName, ProductCatalog.ProductID, ProductCatalog.ProdName, ProductCatalog.UnitPrice,RANK() OVER (ORDER BY ProductCatalog.UnitPrice DESC) AS PriceRankFROM Sales.ProductCatalogORDER BY ProductCatalog.UnitPrice DESC

QUESTION 41CORRECT TEXTYou have a database named Sales that contains the tables shown in the exhibit. (Click the Exhibit button.)

Page 51: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

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 of rows specified by the @Count parameter.

The solution must NOT use BEGIN, END, or DECLARE statements.

Part of the correct Transact-SQL statement has been provided in the answer area. Complete the Transact-SQL statement

Page 52: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:CREATE PROCEDURE usp_Customers @Count intSELECT TOP(@Count) Customers.LastNameFROM CustomersORDER BY Customers.LastName

QUESTION 42You use a Microsoft SQL Server 2012 database that contains a table named BlogEntry that has the following columns. Id is the Primary Key. You need to appendthe "This is in a draft stage" string to the Summary column of the recent 10 entries based on the values in EntryDateTime. Which Transact-SQL statement shouldyou use?

A. UPDATE TOP(10) BlogEntrySET Summary.WRITE(N' This is in a draft stage', NULL, 0)

B. UPDATE BlogEntrySET Summary = CAST(N' This is in a draft stage' as nvarchar(max)) WHERE Id IN(SELECT TOP(10) IdFROM BlogEntry ORDER BY EntryDateTime DESC)

C. UPDATE BlogEntrySET Summary.WRITE(N' This is in a draft stage', NULL, 0)FROM (SELECT TOP(10) Id FROM BlogEntry ORDER BY EntryDateTime DESC) AS sWHERE BlogEntry.Id = s.ID

D. UPDATE BlogEntrySETSummary.WRITE(N' This is in a draft stage', 0, 0)WHERE Id IN(SELECT TOP(10) Id FROM BlogEntry ORDER BY EntryDateTime DESC)

Page 53: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:According to the append possibility of .Write method when offset is specified as NULL.https://msdn.microsoft.com/en-us/library/ms177523.aspx

QUESTION 43You use Microsoft SQL Server 2012 to develop a database application. You create a stored procedure named DeleteJobCandidate. You need to ensure that ifDeleteJobCandidate encounters an error, the execution of the stored procedure reports the error number. Which Transact-SQL statement should you use?

Page 54: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

Page 55: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D. Option D

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms190193.aspxhttp://msdn.microsoft.com/en-us/library/ms188790.aspx

QUESTION 44You use Microsoft SQL Server 2012 to create a stored procedure as shown in the following code segment. (Line numbers are included for reference only.) Theprocedure 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 segment should you add to line 14?

A. IF @@TRANCOUNT = 0

B. IF (XACT_STATE ( ) ) = 0

C. IF (XACT_STATE ( ) ) = 1

D. IF @@TRANCOUNT = l

Page 56: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms189797.aspxhttp://msdn.microsoft.com/en-us/library/ms187967.aspx

QUESTION 45You use Microsoft SQL Server 2012 to develop a database application. Your application sends data to an NVARCHAR(MAX) variable named @var. You need to write a Transact-SQL statement that will find out the success of a cast to a decimal (36,9). Which code segment should you use?

Page 57: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

Page 58: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D. Option D

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/hh213126.aspx

QUESTION 46You are writing a set of queries against a FILESTREAM-enabled database. You create a stored procedure that will update multiple tables within a transaction. Youneed to ensure that if the stored procedure raises a run-time error, the entire transaction is terminated and rolled back. Which Transact-SQL statement should youinclude at the beginning of the stored procedure?

A. SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

B. SET XACT_ABORT OFF

C. SET TRANSACTION ISOLATION LEVEL SNAPSHOT

D. SET IMPLICIT_TRANSACTIONS ON

E. SET XACT_ABORT ON

F. SET IMPLICIT TRANSACTIONS OFF

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms188792.aspx

QUESTION 47You develop a Microsoft SQL Server 2012 database. The database is used by two web applications that access a table named Products. You want to create anobject that will prevent the applications from accessing the table directly while still providing access to the required data. You need to ensure that the followingrequirements are met:- Future modifications to the table definition will not affect the applications' ability to access data.- The new object can accommodate data retrieval and data modification. You need to achieve this goal by using the minimum amount of changes to theapplications. What should you create for each application?

A. Synonyms

B. Common table expressions

Page 59: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. Views

D. Temporary tables

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms190174.aspx

QUESTION 48You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.

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?

A. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW

B. SELECT OrderId, OrderDate, Amount, Name, Country

Page 60: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

FROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers=CustomerId = 1FOR XML RAW, ELEMENTS

C. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML AUTO

D. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

E. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO

F. SELECT Name, Country, Orderld, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

G. SELECT Name AS '@Name', CountryAS '@Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

H. SELECT Name AS 'Customers/Name', CountryAS 'Customers/Country', OrderId,OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

Correct Answer: CSection: (none)Explanation

Page 61: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/bb510464.aspx

QUESTION 49You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.

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.

<CUSTOMERS Name="Customer A" Country="Australia"><ORDERS OrderID="1" OrderDate="2001-01-01" Amount="3400.00" /> <ORDERS OrderID="2" OrderDate="2002-01-01" Amount="4300.00" /> </CUSTOMERS>Which Transact-SQL query should you use?

A. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW

B. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW, ELEMENTS

C. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML AUTO

D. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId - Customers.CustomerId

Page 62: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

WHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

E. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO

F. SELECT Name, Country, Orderld, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

G. SELECT Name AS '@Name', CountryAS '@Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

H. SELECT Name AS'Customers/Name', CountryAS 'Customers/Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

Correct Answer: ESection: (none)Explanation

Explanation/Reference:

QUESTION 50You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.

Page 63: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

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?

A. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW

B. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerId

Page 64: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

WHERE Customers.CustomerId = 1FOR XML RAW, ELEMENTS

C. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML AUTO

D. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

E. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId- 1FOR XML AUTO

F. SELECT Name, Country, Orderld, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1 FOR XML AUTO, ELEMENTS

G. SELECT Name AS '@Name', CountryAS '@Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId=Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

H. SELECT Name AS'Customers/Name', CountryAS 'Customers/Country', OrderId,OrderDate,AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 65: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 51You develop a Microsoft SQL Server 2012 server database that supports an application. The application contains a table that has the following definition:CREATE TABLE Inventory (ItemID int NOT NULL PRIMARY KEY,ItemsInStore int NOT NULL,ItemsInWarehouse int NOT NULL)You need to create a computed column that returns the sum total of the ItemsInStore and ItemsInWarehouse values for each row. The new column is expected tobe queried heavily, and you need to be able to index the column. Which Transact-SQL statement should you use?

A. ALTER TABLE InventoryADD TotalItems AS ItemslnStore + ItemsInWarehouse

B. ALTER TABLE InventoryADD TotalItems AS ItemsInStore + ItemsInWarehouse PERSISTED

C. ALTER TABLE InventoryADD TotalItems AS SUM(ItemsInStore,ItemsInWarehouse) PERSISTED

D. ALTER TABLE InventoryADD TotalItems AS SUM(ItemsInStore, ItemsInWarehouse)

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms174979.aspx

QUESTION 52You develop a Microsoft SQL Server 2012 database that contains a table named Customers. The Customers table has the following definition. You need to createan audit record only when either the MobileNumber or HomeNumber column is updated. Which Transact-SQL query should you use?

Page 66: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. CREATE TRIGGER TrgPhoneNumberChangeON Customers FOR UPDATEASIF COLUMNS_UPDATED (HomeNumber, MobileNumber)- - Create Audit Records

B. CREATE TRIGGER TrgPhoneNumberChangeON Customers FOR UPDATEASIF EXISTS( SELECT HomeNumber FROM inserted) OREXISTS (SELECT MobileNumber FROM inserted)- - Create Audit Records

C. CREATE TRIGGER TrgPhoneNumberChangeON Customers FOR UPDATEASIF COLUMNS_CHANGED (HomeNumber, MobileNumber)- - Create Audit Records

D. CREATE TRIGGER TrgPhoneNumberChangeON Customers FOR UPDATEASIF UPDATE (HomeNumber) OR UPDATE (MobileNumber)- - Create Audit Records

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/bb510663.aspx

Page 67: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://msdn.microsoft.com/en-us/library/ms186329.aspx

QUESTION 53You develop a Microsoft SQL Server 2012 database that has two tables named SavingAccounts and LoanAccounts. Both tables have a column namedAccountNumber of the nvarchar data type.

You use a third table named Transactions that has columns named TransactionId AccountNumber, Amount, and TransactionDate.

You need to ensure that when multiple records are inserted in the Transactions table, only the records that have a valid AccountNumber in the SavingAccounts orLoanAccounts are inserted.

Which Transact-SQL statement should you use?

A. CREATE TRIGGER TrgValidateAccountNumberON TransactionsINSTEAD OF INSERTASBEGININSERT INTO TransactionsSELECT TransactionID,AccountNumber,Amount,TransactionDate FROM insertedWHERE AccountNumber IN(SELECT AccountNumber FROM LoanAccountsUNION SELECT AccountNumber FROM SavingAccounts)END

B. CREATE TRIGGER TrgValidateAccountNumberON TransactionsFOR INSERTASBEGININSERT INTO TransactionsSELECT TransactionID,AccountNumber,Amount,TransactionDate FROM insertedWHERE AccountNumber IN(SELECT AccountNumber FROM LoanAccountsUNION SELECT AccountNumber FROM SavingAccounts)END

C. CREATE TRIGGER TrgValidateAccountNumberON TransactionsINSTEAD OF INSERTASBEGINIF EXISTS (SELECT AccountNumber FROM inserted EXCEPT

Page 68: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

(SELECT AccountNumber FROM LoanAccountsUNION SELECT AccountNumber FROM SavingAccounts))BEGINROLLBACK TRANENDEND

D. CREATE TRIGGER TrgValidateAccountNumberON TransactionsFOR INSERTASBEGINIF EXISTS (SELECT AccountNumber FROM inserted EXCEPT(SELECT AccountNumber FROM LoanAccountsUNION SELECT AccountNumber FROM SavingAccounts))BEGINROLLBACK TRANENDEND

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 54You develop a Microsoft SQL Server 2012 database. You create a view that performs the following tasks:- Joins 8 tables that contain up to 500,000 records each.- Performs aggregations on 5 fields.- The view is frequently used in several reports.You need to improve the performance of the reports. What should you do?

A. Convert the view into a table-valued function.

B. Convert the view into a Common Table Expression (CTE).

C. Convert the view into an indexed view.

D. Convert the view into a stored procedure and retrieve the result from the stored procedure into a temporary table.

Correct Answer: CSection: (none)

Page 69: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms191432.aspx

QUESTION 55You are a database developer of a Microsoft SQL Server 2012 database. The database contains a table named Customers that has the following definition. Youneed to ensure that the CustomerId column in the Orders table contains only values that exist in the CustomerId column of the Customer table. Which Transact-SQL statement should you use?

A. ALTER TABLE OrdersADD CONSTRAINT FX_Orders_CustomerIDFOR EIGN KEY (CustomerId) REFERENCES Customer(CustomerId)

B. ALTER TABLE CustomerADD CONSTRAINT FK_Customer_CustomerIDFOR EIGN KEY {Cu3tomerID; REFERENCES Orders(CustomerId)

C. ALTER TABLE OrdersADD CONSTRAINT CK_Crders_CustomerIDCHECK (CustomerId IN (SELECT CustomerId FROM Customer))

D. ALTER TABLE CustomerADD OrderId INT NOT NULL;ALTER TABLE CustomerADD CONSTRAINT FK_Customer_OrderIDFOR EIGN KEY (CrderlD) REFERENCES Orders(CrderlD);

Page 70: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

E. ALTER TABLE OrdersADD CONSTRAINT PK Orders CustomerId PRIMARY KEY (CustomerID)

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms189049.aspx

QUESTION 56You develop a Microsoft SQL Server 2012 database. You create a view from the Orders and OrderDetails tables by using the following definition. You need toensure that users are able to modify data by using the view. What should you do?

A. Create an AFTER trigger on the view.

B. Modify the view to use the WITH VIEW_METADATA clause.

C. Create an INSTEAD OF trigger on the view.

D. Modify the view to an indexed view.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms187956.aspx

Page 71: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 57Your database contains tables named Products and ProductsPriceLog. The Products table contains columns named ProductCode and Price. The ProductsPriceLogtable contains columns named ProductCode, OldPrice, and NewPrice. The ProductsPriceLog table stores the previous price in the OldPrice column and the newprice in the NewPrice column. You need to increase the values in the Price column of all products in the Products table by 5 percent. You also need to log thechanges to the ProductsPriceLog table. Which Transact-SQL query should you use?

A. UPDATE Products SET Price = Price * 1.05OUTPUT inserted.ProductCode, deleted.Price, inserted.PriceINTO ProductsPriceLog(ProductCode, OldPrice, NewPrice)

B. UPDATE Products SET Price = Price * 1.05OUTPUT inserted.ProductCode, inserted.Price, deleted.PriceINTO ProductsPriceLog(ProductCode, OldPrice, NewPrice)

C. UPDATE Products SET Price = Price * 1.05OUTPUT inserted.ProductCode, deleted.Price, inserted.Price * INTO ProductsPriceLog(ProductCode, OldPrice, NewPrice)

D. UPDATE Products SET Price = Price * 1.05INSERT INTO ProductsPriceLog (ProductCode, CldPnce, NewPrice; SELECT ProductCode, Price, Price * 1.05 FROM Products

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms177564.aspx

QUESTION 58You are developing a database application by using Microsoft SQL Server 2012. An application that uses a database begins to run slowly. Your investigation showsthe root cause is a query against a read-only table that has a clustered index. The query returns the following six columns:- One column in its WHERE clause contained in a non-clustered index.

- Four additional columns.- One COUNT (*) column based on a grouping of the four additional columns.You need to optimize the statement. What should you do?

A. Add a HASH hint to 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 columnstore index to cover the query.

Page 72: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

G. Enable the optimize for ad hoc workloads option.

H. Cover the unique clustered index with a columnstore index.

I. 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.

Correct Answer: FSection: (none)Explanation

Explanation/Reference:

QUESTION 59You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.

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.

Page 73: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Which Transact-SQL query should you use?

A. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers-CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW

B. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers=CustomerId = 1FOR XML RAW, ELEMENTS

C. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML AUTO

D. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOIN CustomersON Orders.CustomerId - Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

E. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerId

Page 74: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

WHERE Customers.CustomerId- 1FOR XML AUTO

F. SELECT Name, Country, Crderld, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

G. SELECT Name AS '@Name', CountryAS '@Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

H. SELECT Name AS 'Customers/Name', CountryAS 'Customers/Country', OrderId,OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

Correct Answer: FSection: (none)Explanation

Explanation/Reference:

QUESTION 60You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit.

Page 75: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to display rows from the Orders table for the Customers row having the Customerld value set to 1 in the following XML format.

Which Transact-SQL query should you use?

A. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOINCustomersON Orders.CustomerId = Customers-CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW

B. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOINCustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML RAW, ELEMENTS

C. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOINCustomersON Orders.CustomerId = Customers.CustomerIdWHERE Customers.CustomerId = 1FOR XML AUTO

D. SELECT OrderId, OrderDate, Amount, Name, CountryFROM Orders INNER JOINCustomersON Orders.CustomerId - Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

E. SELECT Name, Country, OrderId, OrderDate, AmountFROM Orders INNER JOINCustomersON Orders.CustomerId=Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO

Page 76: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

F. SELECT Name, Country, Crderld, OrderDate, AmountFROM Orders INNER JOINCustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML AUTO, ELEMENTS

G. SELECT Name AS '@Name', CountryAS '@Country', OrderId, OrderDate, AmountFROM Orders INNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

H. SELECT Name AS 'Customers/Name', CountryAS 'Customers/Country', OrderId,OrderDate, AmountFROM OrdersINNER JOIN CustomersON Orders.CustomerId= Customers.CustomerIdWHERE Customers.CustomerId= 1FOR XML PATH ('Customers')

Correct Answer: GSection: (none)Explanation

Explanation/Reference:

QUESTION 61You use Microsoft SQL Server 2012 to write code for a transaction that contains several statements. There is high contention between readers and writers onseveral 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?

http://www.gratisexam.com/

A. SERIALIZABLE

B. SNAPSHOT

C. READ COMMITTED SNAPSHOT

D. REPEATABLE READ

Page 77: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:1. "There is high contention between readers and writers"SNAPSHOT and RED COMMITTED SNAPSHOT will not apply share locks so minimize the contention.https://msdn.microsoft.com/en-us/library/ms173763.aspx2. "need to minimize the use of the tempdb space"RED COMMITTED SNAPSHOT uses less tempdb space.https://msdn.microsoft.com/en-us/library/ms378149(v=sql.110).aspx So the answer is RED COMMITTED SNAPSHOT

QUESTION 62You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50students for various subjects. You need to ensure that the top half of the students arranged by their average marks must be given a rank of 1 and the remaining students must be given a rank of2. Which Transact-SQL query should you use?

A. SELECT StudentCode as Code,RANK ( ) OVER (ORDER BY AVG (Marks) DESC)AS Value FROM StudentMarks GROUP BY StudentCode

B. SELECT Id, Name, Marks, DENSE_RANK () OVER (ORDER BY Marks DESC) AS Rank FROM StudentMarks

C. SELECT StudentCode as Code,DENSE_RANK () OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

D. SELECT StudentCode as Code,NTILE (2) OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

E. SELECT StudentCode AS Code,Marks AS ValueFROM (SELECT StudentCode, Marks AS Marks,RANK () OVER (PARTITION BY SubjectCode ORDER BY Marks ASC)AS Rank FROM StudentMarks) tmpWHERE Rank = 1

F. SELECT StudentCode AS Code,Marks AS Value FRCM (SELECT StudentCode, Marks AS Marks,RANK() OVER (PARTITION BY SubjectCode ORDER 3Y Marks DESC)AS Rank FRCM StudentMarks) tmpWHERE Rank = 1

Page 78: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

G. SELECT StudentCode AS Code,Marks AS Value FROM(SELECT StudentCode, Marks AS Marks,RANK () OVER (PARTITION BY StudentCode ORDER BY Marks ASC)AS Rank FROM StudentMarks) tmpWHERE Rank = 1

H. SELECT StudentCode AS Code,Marks AS Value FROM(SELECT StudentCode, Marks AS Marks,RANXO OVER (PARTITION BY StudentCode ORDER BY Marks DESC)AS Rank FROM StudentMarks) tmpWHERE Rank = 1

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 63You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50students 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.- Consecutive ranks must be skipped when the same rank is assigned.Which Transact-SQL query should you use?

A. SELECT StudentCode as Code,RANK ( ) OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

B. SELECT Id, Name, Marks, DENSE_RANK () OVER (ORDER BY Marks DESC) AS RankFROM StudentMarks

C. SELECT StudentCode as Code,DENSE_RANK () OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

D. SELECT StudentCode as Code,NTILE (2) OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

E. SELECT StudentCode AS Code,Marks AS ValueFROM (SELECT StudentCode, Marks AS Marks,RANK () OVER (PARTITION BY SubjectCode ORDER BY Marks ASC)AS Rank

Page 79: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

FROM StudentMarks) tmp WHERE Rank = 1

F. SELECT StudentCode AS Code,Marks AS Value FRCM (SELECT StudentCode, Marks AS Marks,RANK() OVER (PARTITION BY SubjectCode ORDER 3Y Marks DESC)AS RankFROM StudentMarks) tmpWHERE Rank = 1

G. SELECT StudentCode AS Code,Marks AS Value FROM(SELECT StudentCode, Marks AS Marks,RANK () OVER (PARTITION BY StudentCode ORDER BY Marks ASC)AS RankFROM StudentMarks) tmp WHERE Rank = 1

H. SELECT StudentCode AS Code,Marks AS Value FROM(SELECT StudentCode, Marks AS Marks,RANXO OVER (PARTITION BY StudentCode ORDER BY Marks DESC)AS RankFROM StudentMarks) tmp WHERE Rank = 1

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms189798.aspx

QUESTION 64You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid-year marks for students. The table has marks obtained by 50students for various subjects. You need to retrieve the students who scored the highest marks for each subject along with the marks. Which Transact-SQL queryshould you use?

A. SELECT StudentCode as Code,RANK ( ) OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

B. SELECT Id, Name, Marks, DENSE_RANK () OVER (ORDER BY Marks DESC) AS RankFROM StudentMarks

C. SELECT StudentCode as Code,DENSE_RANK () OVER (ORDER BY AVG (Marks) DESC) AS ValueFROM StudentMarks GROUP BY StudentCode

D. SELECT StudentCode as Code,NTILE (2) OVER (ORDER BY AVG (Marks) DESC) AS Value

Page 80: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

FROM StudentMarks GROUP BY StudentCode

E. SELECT StudentCode AS Code,Marks AS ValueFROM (SELECT StudentCode, Marks AS Marks,RANK () OVER (PARTITION BY SubjectCode ORDER BY Marks ASC)AS RankFROM StudentMarks) tmp WHERE Rank = 1

F. SELECT StudentCode AS Code,Marks AS Value FRCM (SELECT StudentCode, Marks AS Marks,RANK() OVER (PARTITION BY SubjectCode ORDER 3Y Marks DESC)AS RankFRCM StudentMarks) tmp WHERE Rank = 1

G. SELECT StudentCode AS Code,Marks AS Value FROM(SELECT StudentCode, Marks AS Marks,RANK () OVER (PARTITION BY StudentCode ORDER BY Marks ASC)AS RankFROM StudentMarks) tmp WHERE Rank = 1

H. SELECT StudentCode AS Code,Marks AS Value FROM(SELECT StudentCode, Marks AS Marks,RANXO OVER (PARTITION BY StudentCode ORDER BY Marks DESC)AS RankFROM StudentMarks) tmp WHERE Rank = 1

Correct Answer: FSection: (none)Explanation

Explanation/Reference:

QUESTION 65You develop a Microsoft SQL Server 2012 database that contains tables named Customers and Orders. The tables are related by a column named CustomerId.You need to create a query that meets the following requirements:- Returns the CustomerName for all customers and the OrderDate for any orders that they have placed.- Results must not include customers who have not placed any orders.Which Transact-SQL query should you use?

A. SELECT CustomerName, OrderDateFROM Customers LEFT OUTER JOIN OrdersON Customers.CuscomerlD = Orders.CustomerId

B. SELECT CustomerName, OrderDateFROM Customers RIGHT OUTER JOIN Orders

Page 81: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

ON Customers.CustomerID = Orders.CustomerId

C. SELECT CustomerName, OrderDateFROM Customers CROSS JOIN OrdersON Customers.CustomerId = Orders.CustomerId

D. SELECT CustomerName, OrderDateFROM Customers JOIN OrdersON Customers.CustomerId = Orders.CustomerId

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms177634.aspx

QUESTION 66You develop a Microsoft SQL Server 2012 database. You need to create a batch process that meets the following requirements:- Status information must be logged to a status table.- If the status table does not exist at the beginning of the batch, it must be created.Which object should you use?

A. Scalar user-defined function

B. Inline user-defined function

C. Table-valued user-defined function

D. Stored procedure

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms186755.aspx

QUESTION 67You administer a database that includes a table named Customers that contains more than 750 rows. You create a new column named PartitionNumber of the inttype 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 thefollowing conditions:- Always starts with 1.

Page 82: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

- Starts again from 1 after it reaches 100.Which Transact-SQL statement should you use?

A. CREATE SEQUENCE CustomerSequence AS intSTART WITH 0INCREMENT BY 1MINVALUE 1MAXVALUE 100UPDATE Customers SET PartitionNumber = NEXT VALOEFOR CustomerSequenceDROP SEQUENCE CustomerSequence

B. CREATE SEQUENCE CustomerSequence AS intSTART WITH 1INCREMENT BY 1MINVALUE 1 MAXVALUE 100CYCLEUPDATE Customers SET PartitionNumber = NEXT VALUEFOR CustomerSequenceDROP SEQUENCE CustomerSequence

C. CREATE SEQUENCE CustomerSequence AS intSTART WITH 1INCREMENT BY 1MINVALUE 1MAXVALUE 100UPDATE Customers SET PartitionNumber = NEXT VALUEFOR CustomerSequence + 1DROP SEQUENCE CustomerSequence

D. CREATE SEQUENCE CustomerSequence AS intSTART WITH 1INCREMENT BY 1MINVALUE 0MAXVALUE 100CYCLEUPTATE Customers SET PartitionNumber = NEXT VALUEFOR CustomerSequenceDROP SEQUENCE CustomerSequence

Correct Answer: BSection: (none)Explanation

Page 83: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ff878091.aspx

QUESTION 68You use Microsoft SQL Server 2012 to develop a database application. You need to implement a computed column that references a lookup table by using anINNER JOIN against another table.What should you do?

A. Reference a user-defined function within the computed column.

B. Create a BEFORE trigger that maintains the state of the computed column.

C. Add a default constraint to the computed column that implements hard-coded values.

D. Add a default constraint to the computed column that implements hard-coded CASE statements.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 69You are a database developer for an application hosted on a Microsoft SQL Server 2012 server. The database contains two tables that have the followingdefinitions:

Global customers place orders from several countries. You need to view the country from which each customer has placed the most orders. Which Transact-SQLquery do you use?

Page 84: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 85: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

D. Option D

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 70You use Microsoft SQL Server 2012 to develop a database application. You need to create an object that meets the following requirements:- Takes an input variable.- Returns a table of values Cannot be referenced within a view.Which object should you use?

A. Scalar-valued function

B. Inline function

C. User-defined data type

D. Stored procedure

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 71You administer a Microsoft SQL Server 2012 database named ContosoDb. The database contains a table named Suppliers and a column named IsActive in thePurchases schema. You create a new user named ContosoUser in ContosoDb. ContosoUser has no permissions to the Suppliers table. You need to ensure thatContosoUser can delete rows that are not active from Suppliers. You also need to grant ContosoUser only the minimum required permissions. Which Transact-SQLstatement should you use?

A. GRANT DELETE ONPurchases.Suppliers TO ContosoUser

B. CREATE PROCEDURE

Page 86: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Purchases.PurgeInactiveSu ppliersWITH EXECUTE AS USER = 'dbo'ASDELETE FROM Purchases.SuppliersWHERE IsActive = 0GO GRANT EXECUTE ONPurchases.PurgelnactiveSu ppliers TO ContosoUser

C. GRANT SELECT ONPurchases.Suppliers TO ContosoUser

D. CREATE PROCEDUREPurchases.PurgeInactiveSu ppliersASDELETE FROM Purchases.SuppliersWHERE IsActive = 0GOGRANT EXECUTE ONPurchases.PurgeInactiveSu ppliers TO ContosoUser

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:Incorrect syntax near the keyword `USER' in option B.http://msdn.microsoft.com/en-us/library/ms188354.aspxhttp://msdn.microsoft.com/en-us/library/ms187926.aspx

QUESTION 72Your 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. Youneed to write a query that will return the correct results in the most efficient manner. Which Transact-SQL query should you use?

A. SELECT COUNT (*) FROM SaLeaOrdersWHERE OrderTime = CONVERT(DATE, GETDATE ())

B. SELECT COUNT(*) FROM SalesOrdersWHERE OrderTime - GETDATE()

C. SELECT COUNT(-) FROM SaLesCrdersWHERE CONCERT(VARCHAR, OrderTime, 112) =CONVERT (VARCHAR, GETDATE(I, 112)

D. SELECT CCUNT(*) FROM SalesCrder3

Page 87: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

WHERE CrderTime >= CONVERT(DATE, GETDATE())AND CrderTime < DATEADD(DAY, CONVERT(DATS, GETDATE()))

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:Two answers will return the correct results: the "WHERE CONVERT..." and "WHERE ... AND ... " answers. The correct answer for Microsoft would be the answerthat is most "efficient". Anybody have a clue as to which is most efficient? In the execution plan, the one that I've selected as the correct answer is the query with theshortest duration. Also, the query answer with "WHERE CONVERT..." threw warnings in the execution plan... something about affecting CardinalityEstimate andSeekPlan. I also found this article, which leads me to believe that I have the correct answer.http://technet.microsoft.com/en-us/library/ms181034.aspx

QUESTION 73Your application contains a stored procedure for each country. Each stored procedure accepts an employee identification number through the @EmpID parameter.You plan to build a single process for each employee that will execute the stored procedure based on the country of residence. Which approach should you use?

A. a recursive stored procedure

B. Trigger

C. An UPDATE statement that includes CASE

D. Cursor

E. The foreach SQLCLR statement

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 74You use Microsoft SQL Server 2012 to develop a database application. You create a stored procedure named dbo.ModifyData that can modify rows. You need toensure that when the transaction fails, dbo.ModifyData meets the following requirements:- Does not return an error.- Closes all opened transactions.Which Transact-SQL statement should you use?

A. BEGIN TRANSACTION

Page 88: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

BEGIN TRYEXEC dbo.ModifyDataCOMMIT TRANSACTIONEND TRYBEGIN CATCHIF @@ TRANCOUNT = 0ROLLBACK TRANSACTION;END CATCH

B. BEGIN TRANSACTIONBEGIN TRYEXEC dbo.ModifyDataCOMMIT TRANSACTIONEND TRYBEGIN CATCHIF @@ERRCR != 0ROLLBACK TRANSACTION;THROW;END CATCH

C. BEGIN TRANSACTIONBEGIN TRYEXEC dbo.ModifyDataCOMMIT TRANSACTIONEND TRYBEGIN CATCHIF @@TRANCOUNT = 0ROLLBACK TRANSACTION;THROW;END CATCH

D. BEGIN TRANSACTIONBEGIN TRYEXEC dbo.ModifyDataCOMMIT TRANSACTIONEND TRYBEGIN CATCHIF @@ZRROR !- 0ROLLBACK TRANSACTION;END CATCH

Correct Answer: DSection: (none)Explanation

Page 89: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:Option A & C are wrong: IF @@ TRANCOUNT = 0, means that no transaction was executed. @@TRANCOUNT indicates the number of BEGIN TRANSACTIONencountered before the @@TRANCOUNT code. Option B is also wrong because of the THROW clause: the requirement says "should not return any error".

QUESTION 75You are developing a database application by using Microsoft SQL Server 2012. An application that uses a database begins to run slowly. You discover that duringreads, the transaction experiences blocking from concurrent updates. You need to ensure that throughout the transaction the data maintains the original version.What should you do?

A. Add a HASH hint to 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 columnstore index to cover the query.

G. Enable the optimize for ad hoc workloads option.

H. Cover the unique clustered index with a columnstore index.

I. 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.

Correct Answer: MSection: (none)Explanation

Explanation/Reference:

QUESTION 76You are developing a database application by using Microsoft SQL Server 2012. You have a query that runs slower than expected. You need to capture executionplans that will include detailed information on missing indexes recommended by the query optimizer. What should you do?

Page 90: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://www.gratisexam.com/

A. Add a HASH hint to 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 columnstore index to cover the query.

G. Enable the optimize for ad hoc workloads option.

H. Cover the unique clustered index with a columnstore index.

I. 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.

Correct Answer: KSection: (none)Explanation

Explanation/Reference:

QUESTION 77You are developing a database application by using Microsoft SQL Server 2012. An application that uses a database begins to run slowly. You discover that a largeamount of memory is consumed by single-use dynamic queries. You need to reduce procedure cache usage from these statements without creating any additionalindexes. What should you do?

A. Add a HASH hint to 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.

Page 91: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

E. Add a FORCESCAN hint to the Attach query.

F. Add a columnstore index to cover the query.

G. Enable the optimize for ad hoc workloads option.

H. Cover the unique clustered index with a columnstore index.

I. 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.

Correct Answer: GSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/cc645587.aspx

QUESTION 78CORRECT TEXTYou have a database that contains the tables as shown below:

Page 92: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You have a stored procedure named Procedure1. Procedure1 retrieves all order ids after a specific date. The rows for Procedure1 are not sorted. Procedure1 has asingle parameter named Parameter1. Parameter1 uses the varchar type and is configured to pass the specific date to Procedure1. A database administratordiscovers that OrderDate is not being compared correctly to Parameter1 after the data type of the column is changed to datetime. You need to update the SELECTstatement to meet the following requirements:

The code must NOT use aliases.The code must NOT use object delimiters.The objects called in Procedure1 must be able to be resolved by all users.OrderDate must be compared to Parameter1 after the data type of Parameter1 is changed to datetime.

Which SELECT statement should you use?

Page 93: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

To answer, type the correct code in the answer area.

Answer: Please review the explanation part for this answer

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:SELECT Orders.OrderIDFROM OrdersWHERE Orders.OrderDate>CONVERT(datetime,@Parameter1)

QUESTION 79You use Microsoft SQL Server 2012 database to develop a shopping cart application. You need to invoke a table-valued function for each row returned by a query.Which Transact-SQL operator should you use?

A. CROSS JOIN

B. UNPIVOT

C. PIVOT

D. CROSS APPLY

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:http://msdn.microsoft.com/en-us/library/ms175156.aspx

QUESTION 80DRAG DROPYou 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 to the answer area andarrange them in the correct order.)

Select and Place:

Page 94: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 95: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:Reference: http://msdn.microsoft.com/en-us/library/ms187956.aspx

QUESTION 81What is the difference between the simple CASE expression and the searched CASE expression?

A. The simple CASE expression is used when the database recovery model is simple, and the searched CASE expression is used when it's full or bulk logged.

B. The simple CASE expression compares an input expression to multiple possible expressions in the WHEN clauses, and the searched CASE expression usesindependent predicates in the WHEN clauses.

C. The simple CASE expression can be used anywhere in a query, and the searched CASE expression can be used only in the WHERE clause.

D. The simple CASE expression can be used anywhere in a query, and the searched CASE expression can be used only in query filters (ON, WHERE, HAVING).

Correct Answer: BSection: (none)

Page 96: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 82DRAG DROPYou use Microsoft SQL Server 2012 to develop a database application.

You create two tables by using the following table definitions.

Which six Transact-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements to the answer area and arrangethem in the correct order.)

Select and Place:

Page 97: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 98: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

Page 99: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 83DRAG DROPYou create the following stored procedure. (Line numbers are included for reference only.)

You need to ensure that the stored procedure performs the following tasks:

If a record exists, update the record.If no record exists, insert a new record.

Which four Transact-SQL statements should you insert at line 07? (To answer, move the appropriate statements from the list of statements to the answer area andarrange them in the correct order.)

Select and Place:

Page 100: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 101: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:Reference: http://technet.microsoft.com/en-us/library/bb510625.aspx

QUESTION 84DRAG DROPYou use Microsoft SQL Server 2012 to develop a database that has two tables named Div1Cust and Div2Cust.

Each table has columns named DivisionID and CustomerId. None of the rows in Div1Cust exist in Div2Cust.

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

Page 102: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

The rows in Div1Cust must be combined with the rows in Div2Cust.The result set must have columns named Division and Customer.Duplicates must be retained.

Which three Transact-SQL statements should you use? (To answer, move the appropriate statements from the list of statements to the answer area and arrangethem in the correct order.)

Select and Place:

Correct Answer:

Page 103: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

QUESTION 85DRAG DROPYou create a view based on the following statement:

Page 104: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You grant the Select permission to User1 for this view.

You need to change the view so that it displays only the records that were processed in the month prior to the current month. You need to ensure that after thechanges, the view functions correctly for User1.

Which four Transact-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements to the answer area andarrange them in the correct order.)

Select and Place:

Page 105: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 106: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:Reference: http://msdn.microsoft.com/en-us/library/hh213020.aspxReference: http://msdn.microsoft.com/en-us/library/ms186819.aspx

Page 107: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Reference: http://msdn.microsoft.com/en-us/library/ms173846.aspx

QUESTION 86DRAG DROPYou use Microsoft SQL Server 2012 to develop a database application.

You create a table by using the following definition:

CREATE TABLE Prices (PriceId int IDENTITY(1,1) PRIMARY KEY,ActualPrice NUMERIC(16,9),PredictedPrice NUMERIC(16,9))

You need to create a computed column based on a user-defined function named udf_price_index. You also need to ensure that the column supports an index.

Which three Transact-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements to the answer area andarrange them in the correct order.)

Select and Place:

Page 108: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 109: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

Page 110: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 87DRAG DROPYou use a Microsoft SQL Server 2012 database.

You need to create an indexed view within the database for a report that displays Customer Name and the total revenue for that customer.

Which four T-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements to the answer area and arrange themin the correct order.)

Select and Place:

Page 111: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 112: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:Reference: http://msdn.microsoft.com/en-us/library/ms191432.aspxRead all restrictions for indexed views.Also read this useful question:http://stackoverflow.com/questions/12419330/how-to-create-indexed-view-with-select-distinct-statement-insql-2005

Page 113: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 88DRAG DROPYou administer a Microsoft SQL Server 2012 database. You use an OrderDetail table that has the following definition:

You need to create a non-clustered index on the SalesOrderID column in the OrderDetail table to include only rows that contain a value in the SpecialOfferIDcolumn. Which four Transact-SQL statements should you use?

(To answer, move the appropriate statements from the list of statements to the answer area and arrange them in the correct order.)

Select and Place:

Page 114: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 115: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Page 116: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 89DRAG DROPYou want to add a new GUID column named BookGUID to a table named dbo.Book that already contains data.

BookGUID will have a constraint to ensure that it always has a value when new rows are inserted into dbo.Book.

You need to ensure that the new column is assigned a GUID for existing rows.

Which four Transact-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements to the answer area andarrange them in the correct order.)

Select and Place:

Correct Answer:

Page 117: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:Actually, in the real world, you don't have to use WITH VALUES at the end of the statement and it works just as well. But because the question specifically stateswhich FOUR TSQL statements to use, we have to include it.

Reference: http://msdn.microsoft.com/en-us/library/ms190273.aspx

QUESTION 90You administer a Microsoft SQL Server 2012 database. The database contains a table named Employee. Part of the Employee table is shown in the exhibit.

Page 118: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 119: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 120: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Unless stated above, no columns in the Employee table reference other tables. Confidential information about the employees is stored in a separate table namedEmployeeData. One record exists within EmployeeData for each record in the Employee table. You need to assign the appropriate constraints and table propertiesto ensure data integrity and visibility. On which column in the Employee table should you a create a self-reference foreign key constraint?

A. DateHired

B. DepartmentID

C. EmployeelD

D. EmployeeNum

E. FirstName

F. JobTitle

G. LastName

H. MiddleName

I. ReportsToID

Correct Answer: ISection: (none)Explanation

Explanation/Reference:

QUESTION 91CORRECT TEXTYou need to create a table named OrderDetails on a new server. OrderDetails must meet the following requirements:

Contain a new column named LineltemTotal that stores the product of ListPrice and Quantity for each row.The calculation for a line item total must not be run every time the table is queried.The code must NOT use any object delimiters.

The solution must ensure that LineItemTotal is stored as the last column in the table.Part of the correct T-SQL statement has been provided in the answer area. Provide the complete code.

Page 121: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://www.gratisexam.com/

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:CREATE TABLE OrderDetails(ListPrice money NOT NULL,Quantity int NOT NULL,LineItemTotal AS (ListPrice * Quantity) PERSISTED)

QUESTION 92CORRECT TEXTYou have an XML schema collection named Sales.InvoiceSchema.

You need to declare a variable of the XML type named invoice. The solution must ensure that the invoice is validated by using Sales.InvoiceSchema.

The solution must ensure that the invoice variable is validated by using Sales.InvoiceSchema schema.

Provide the correct code in the answer area.

Correct Answer: DECLARE @invoice XML(Sales.InvoiceSchema)Section: (none)Explanation

Explanation/Reference:

QUESTION 93Why is it important to use standard SQL code when possible and know what is standard and what isn't? (Choose all that apply.)

Page 122: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. It is not important to code using standard SQL.

B. Standard SQL code is more portable between platforms.

C. Standard SQL code is more efficient.

D. Knowing what standard SQL code is makes your knowledge more portable.

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:

QUESTION 94Which of the following is not a violation of the relational model?

A. Using ordinal positions for columns

B. Returning duplicate rows

C. Not defining a key in a table

D. Ensuring that all attributes in the result of a query have names

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 95What is the relationship between SQL and T-SQL?

A. T-SQL is the standard language and SQL is the dialect in Microsoft SQL Server.

B. SQL is the standard language and T-SQL is the dialect in Microsoft SQL Server.

C. Both SQL and T-SQL are standard languages.

D. Both SQL and T-SQL are dialects in Microsoft SQL Server.

Correct Answer: BSection: (none)Explanation

Page 123: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 96Which of the following correctly represents the logical query processing order of the various query clauses?

A. SELECT > FROM > WHERE > GROUP BY > HAVING > ORDER BY

B. FROM > WHERE > GROUP BY > HAVING > SELECT > ORDER BY

C. FROM > WHERE > GROUP BY > HAVING > ORDER BY > SELECT

D. SELECT > ORDER BY > FROM > WHERE > GROUP BY > HAVING

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 97Which of the following is invalid? (Choose all that apply.)

A. Referring to an attribute that you group by in the WHERE clause

B. Referring to an expression in the GROUP BY clause; for example, GROUP BY YEAR(orderdate)

C. In a grouped query, referring in the SELECT list to an attribute that is not part of

D. the GROUP BY list and not within an aggregate function Referring to an alias defined in the SELECT clause in the HAVING clause

Correct Answer: CDSection: (none)Explanation

Explanation/Reference:

QUESTION 98What is true about the result of a query without an ORDER BY clause?

A. It is relational as long as other relational requirements are met.

B. It cannot have duplicates.

C. The order of the rows in the output is guaranteed to be the same as the insertion order.

Page 124: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D. The order of the rows in the output is guaranteed to be the same as that of the clustered index.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 99What is the importance of the ability to assign attribute aliases in T-SQL? (Choose all that apply.)

A. The ability to assign attribute aliases is just an aesthetic feature.

B. An expression that is based on a computation results in no attribute name unless you assign one with an alias, and this is not relational.

C. T-SQL requires all result attributes of a query to have names.

D. Using attribute aliases, you can assign your own name to a result attribute if you need it to be different than the source attribute name.

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:

QUESTION 100What are the mandatory clauses in a SELECT query, according to T-SQL?

A. The FROM and SELECT clauses

B. The SELECT and WHERE clauses

C. The SELECT clause

D. The FROM and WHERE clauses

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 101

Page 125: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Which of the following practices are considered bad practices? (Choose all that apply.)

A. Aliasing columns by using the AS clause

B. Aliasing tables by using the AS clause

C. Not assigning column aliases when the column is a result of a computation

D. Using * in the SELECT list

Correct Answer: CDSection: (none)Explanation

Explanation/Reference:

QUESTION 102Why is it important to use the appropriate type for attributes?

A. Because the type of your attribute enables you to control the formatting of the values

B. Because the type constrains the values to a certain domain of supported values

C. Because the type prevents duplicates

D. Because the type prevents NULLs

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 103Which of the following functions would you consider using to generate surrogate keys? (Choose all that apply.)

A. NEWID

B. NEWSEQUENTIALID

C. GETDATE

D. CURRENT_TIMESTAMP

Correct Answer: ABSection: (none)

Page 126: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 104CORRECT TEXTYou need to create a view named uv_CustomerFullNames. The view must prevent the underlying structure of the customer table from being changed.

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

Correct Answer: Please review the explanation part for this answerSection: (none)Explanation

Explanation/Reference:Explanation:CREATE VIEW sales.uv_CustomerFullNamesWITH SCHEMABINDINGAS SELECTFirstName,LastNameFROM Sales.Customers

QUESTION 105You are designing a data warehouse that uses SQL Server 2012. You are preparing to update the contents of a fact table that contains a non-clustered columnstoreindex. You need to run an update statement against the table. What should you do first?

A. Pause the columnstore index.

B. Change the recovery model of the database to Bulk-logged.

C. Change the non-clustered columnstore index to be a clustered columnstore index.

D. Drop the columnstore index.

Correct Answer: DSection: (none)

Page 127: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 106You need to extract data from a table in a SQL Server 2012 database. What connection manager types can you use? (Choose all that apply.)

http://www.gratisexam.com/

A. An ODBC connection manager

B. An OLE DB connection manager

C. A File connection manager

D. An ADO.NET connection manager

Correct Answer: ABDSection: (none)Explanation

Explanation/Reference:

QUESTION 107You create a view based on the following statement.

Page 128: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You grant the Select permission to User1. You need to change the view so that it displays only the records that were processed in the month prior to the currentmonth. You need to ensure that after

the changes, the view functions correctly for User1. Which Transact-SQL statement should you use?

A. Option A

B. Option B

C. Option C

D. Option D

Correct Answer: CSection: (none)Explanation

Page 129: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 108You develop a database application. You create four tables. Each table stores different categories of products. You create a Primary Key field on each table. Youneed 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 do?

A. Create a ROWVERSION column.

B. Create a SEQUENCE object that uses the INTEGER data type.

C. Use the INTEGER data type along with IDENTITY.

D. Use the UNIQUHDENTTFIER data type along with NEWSEQUENTIALID().

E. Create a TIMESTAMP column.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:It takes less space than the UNIQUEIDENTIFIER datatype (16Bytes) vs INT (4Bytes). It would be unique across whatever calls it, because a SEQUENCE is anindependent object, getting its next value with the NEXT VALUE FOR SeqName, defining a constraint on the PrimaryKey of all tablesas:ALTER TABLE tnameADD CONSTRAINT DFT_tname_cnameDEFAULT(NEXT VALUE FOR SeqName) FOR cname;

QUESTION 109Your database contains a table named Customer that has columns named CustomerID and Name. You want to write a query that retrieves data from the Customertable sorted by Name listing 20 rows at a time. You need to view rows 41 through 60. Which Transact-SQL query should you create?

Page 130: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Option A

B. Option B

C. Option C

D. Option D

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 110DRAG DROPYou write the following SELECT statement to get the last order date for a particular customer.

You need to create the user-defined function to return the last order date for the specified customer.

Which five Transact-SQL statements should you use? (To answer, move the appropriate SQL statements from the list of statements to the answer area andarrange them in the correct order.)

Select and Place:

Page 131: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 132: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 133: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 134: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Note:* First function header* Then declare that the function returns a datetime* Thirdly begin the function body.* Fourthly declare the return variable* At last include the code that retrieves the required date.

QUESTION 111Your 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 shouldyou use?

A. A SELECT statement that includes CASE

B. Cursor

C. BULK INSERT

D. View

E. A user-defined function

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 112As part of a new enterprise project, you're designing a new table to store financial transactions. This table could eventually store millions of rows and so storagespace is very important. One of the columns in the table will store either a 1 or 0 value. Which data type would be most appropriate?

A. bit

B. tinyint

C. numeric

D. float

Correct Answer: A

Page 135: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

QUESTION 113Which of the following conversions is NOT allowed either implicitly or explicitly using CONVERT OR CAST?

A. varchar to decimal

B. decimal to bit

C. date to varchar

D. datetime to text

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:There are very few conversions which are allowed to the Text data type. They include varchar, char, nchar, nvarchar and ntext. Converting datetime to text is not anallowed conversion using either CAST or CONVERT.

QUESTION 114What is wrong with the T-SQL batch statement below.@find varchar(30);SET @find = 'Man';SELECT LastName FROM Person WHERE LastName = @find;

A. You can't use the @find parameter in a query

B. DECLARE is missing

C. Nothing, it's fine

D. You should use SELECT instead of SET

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:

Page 136: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Variables are declared in the body of a batch or procedure with the DECLARE statement and are assigned values by using either a SET or SELECT statement.

QUESTION 115You're designing a new table that will hold information about medical records. Another table called documents contains a foreign key that references this table. Tomake sure information is cleaned up when a delete operation is performed, you've added an ON DELETE CASCADE statement to the foreign key relationship.What will happen when a row is deleted from the medical records table?

A. Corresponding rows in the referenced table (documents) will be deleted

B. All the values that make up the foreign key are set to NULL in the documents table

C. All the values that comprise the foreign key are set to their default values in the documents table

D. Rows are deleted from the medical records table but the documents table is unchanged

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Don't forget that ON DELETE statements are included as part of the foreign key relationship.

QUESTION 116Which of the following is an example of a scalar subquery?

A. select max(price) from products

B. select sum(price) from products

C. select min(price) from products

D. All of these

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 117If you use the BEGIN TRANSACTION statement, then execute 2 insert statements and 2 delete statements what will happen if you execute ROLLBACKTRANSACTION?

Page 137: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Only the INSERT statements will be rolled back

B. All of the INSERTS and DELETES will be rolled back

C. Only the last INSERT and last DELETE statement will be rolled back

D. Only the DELETE statements will be rolled back

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:BEGIN TRANSACTION represents a point at which the data referenced by a connection is logically and physically consistent. All modifications are erased when youissue a ROLLBACK TRANSACTION statement.

QUESTION 118Your manager has asked you to design a new table and enforce rules for the type of information that can be stored in a particular column. The information mustmatch a particular pattern e.g. a number between 1 and 7. This checking must be performed during insert or update operations.Which parameter should you use when you create the column?

A. CHECK

B. DEFAULT

C. Foreign Key

D. Primary Key

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 119What is missing from the T-SQL statement below for creating and using a cursor? DECLARE mycursor CURSOR FOR SELECT * FROM Vendor FETCH NEXTFROM mycursor;

A. KEYSET

B. OPEN

C. STATIC

D. SCROLL

Page 138: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:You need to open the CURSOR before you can call FETCH.

QUESTION 120Complete the missing word below. A ____ is a special kind of stored procedure that executes automatically when a user attempts the specified data-modificationstatement on the specified table.

A. Constraint

B. DLL

C. View

D. Trigger

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 121Your manager has asked you to check the index stats for a particular table called Address. You have executed the following query (see below) and it reported thatthe avg_fragmentation_in_percent is 15%. What should you do?SELECT * FROM sys.dm_db_index_physical_stats (DB_ID(N'Test'), OBJECT_ID(N'Address'), NULL, NULL , 'DETAILED');

A. Run ALTER INDEX REBUILD WITH (ONLINE = ON)

B. Run ALTER INDEX REORGANIZE

C. Rebuild the table

D. Nothing, the index fragmentation is at a safe level

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

Page 139: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation:Generally, you should reorganize indexes if the fragmentation is between 5 and 30 percent. You should rebuild the index if the fragmentation is over 30 percent.Remember, these values provide a rough guideline for determining the point at which you should switch between ALTER INDEX REORGANIZE and ALTER INDEXREBUILD. However, the actual values may vary from case to case. It is important that you experiment to determine the best threshold for your environment.

QUESTION 122You need to write a new query that will return names from the employee table for people who are not part of the contractors table (the two tables share a unique id,similar to social security or NI number). Your query will use a sub query to check that the employee is not in the contractors table.How might you achieve this?

A. Use COALESCE

B. Use EXISTS

C. Use IS_MEMBER

D. Use EXP

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 123Your manager has asked you to extend one of the complex stored procedures used to calculate time differences between lab test results. In particular, during thestored procedures you need to check the exact minute value of a datatime value. Your manager has suggested that you use the DATENAME function and pass inthe date and datepart argument. Which datepart argument should you use to get the minute?

A. m

B. n

C. mcs

D. mm

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:If you want to get the minute, you can either pass in mi or n as the argument to DATENAME.

Page 140: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 124You're designing a new SQL Server 2012 table that will hold millions of records. The table will be used by a finance application to show historical transactions. Thetable only has 10 columns but it's vital that the table performs well. How many primary keys should you create for the table for best performance?

http://www.gratisexam.com/

A. 2

B. 10

C. 3

D. 1

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:You can only have 1 primary key per table.

QUESTION 125You've created a standard stored procedure that's not a CLR procedure. This procedure has several parameters, some of which are output parameters. Which ofthe following CANNOT be passed back as an output parameter from a stored procedure?

A. Text

B. image

C. Ntext

D. Any of these

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:Unless you create a CLR procedure, you can use these data types are return values.

Page 141: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 126You need to delete a stored procedure from the SQL Server 2012 database. The stored procedure is called MyProc. Which statement below is correct?

A. drop MyProc

B. delete procedure MyProc

C. delete MyProc

D. drop procedure MyProc

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:You must drop (delete) the stored procedure using the drop procedure statement followed by the stored procedure name.

QUESTION 127As part of a new HR project you're creating several stored procedures that will add logging information to the logs table. This logging information is very detailed andshould contain carriage returns to make paragraphs more readable. How can you add carriage returns to text when inserting into a table?

A. Use CASE

B. Use CHAR

C. Use TEXTPTR

D. Use COS

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:You can use CHAR(13) to add carriage returns. The CHAR function converts an int ASCII code to a character.

QUESTION 128You're designing a new SQL Server 2012 query for the HR department. The query will find records from the persons table for people whose name starts with 'Ja'.Which WHERE statement would be the correct choice?

A. where (name like 'Ja%')

B. where (name = 'Ja%')

Page 142: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. where (name > 'Ja')

D. where (name like '%Ja%')

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 129SQL Server 2012 uses the standard four-part naming convention when referencing database objects. Which of the following is the correct example of the four-partnaming?

A. server_name.schema_name.database_name.object_name

B. schema_name.object_name.server_name.database_name

C. object_name.server_name.schema_name.database_name

D. server_name.database_name.schema_name.object_name

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:You can use variations of the four-part naming such as:database_name.[schema_name].object_name schema_name.object_name object_name

QUESTION 130You 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 rootcause 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 anon-clustered index and one additional column. You need to optimize the statement. What should you do?

A. Add a HASH hint to 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 columnstore index to cover the query.

Page 143: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

G. Enable the optimize for ad hoc workloads option.

H. Cover the unique clustered index with a columnstore index.

I. 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.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 131You administer a Microsoft SQL Server 2012 database. The database contains a table named Employee. Part of the Employee table is shown in the exhibit.

Page 144: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Unless stated above, no columns in the Employee table reference other tables. Confidential information about the employees is stored in a separate table namedEmployeeData. One record exists within EmployeeData for each record in the Employee table. You need to assign the appropriate constraints and table propertiesto ensure data integrity and visibility. On which column in the Employee table should you create a Foreign Key constraint that references a different table in thedatabase?

A. DateHired

B. DepartmentID

C. EmployeeID

D. EmployeeNum

E. FirstName

F. JobTitle

G. LastName

H. MiddleName

I. ReportsToID

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:Use the EmployeeID, which would be used as a primary key in the Employee table, when defining a foreign key constraint from another table in the database.

QUESTION 132

Page 145: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You administer a Microsoft SQL Server 2012 database. The database contains a table named Employee. Part of the Employee table is shown in the exhibit.

Unless stated above, no columns in the Employee table reference other tables. Confidential information about the employees is stored in a separate table namedEmployeeData. One record exists within EmployeeData for each record in the Employee table. You need to assign the appropriate constraints and table propertiesto ensure data integrity and visibility.On which column in the Employee table should you create a Primary Key constraint for this table?

Page 146: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. DateHired

B. DepartmentID

C. EmployeeID

D. EmployeeNum

E. FirstName

F. JobTitle

G. LastName

H. MiddleName

I. ReportsToID

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 133You have a Microsoft SQL Server database that includes two tables named EmployeeBonus and BonusParameters. The tables are defined by using the followingTransact-SQL statements.

Page 147: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

The tables are used to compute a bonus for each employee. The EmployeeBonus table has a non- null value in either the Quarterly, HalfYearly or Yearly column.This value indicates which type of bonus an employee receives. The BonusParameters table contains one row for each calendar year that stores the amount ofbonus money available and a company performance indicator for that year. You need to calculate a bonus for each employee at the end of a calendar year. WhichTransact-SQL statement should you use?

A. SELECTCAST(CHOOSE((Quarterly * AvailableBonus * CompanyPerformance)/40, (HalfYearly * AvailableBonus * CompanyPerformance)/20, (Yearly * AvailableBonus *CompanyPerformance)/10) AS money) AS `Bonus' FROM EmployeeBonus, BonusParameters

B. SELECT "Bonus" =CASE EmployeeBonus

Page 148: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

WHEN Quarterly=1 THEN (Quarterly * AvailableBonus *CompanyPerformance)/40 WHEN HalfYearly=1 THEN (HalfYearly * AvailableBonus * CompanyPerformance)/20 WHEN Yearly=1 THEN (Yearly * AvailableBonus * CompanyPerformance)/10 ENDFROM EmployeeBonus,BonusParameters

C. SELECTCAST(COALESCE((Quarterly * AvailableBonus * CompanyPerformance)/40, (HalfYearly * AvailableBonus * CompanyPerformance)/20, (Yearly * AvailableBonus* CompanyPerformance)/10) AS money) AS `Bonus' FROM EmployeeBonus, BonusParameters

D. SELECTNULLIF(NULLIF((Quarterly * AvailableBonus *CompanyPerformance)/40,(HalfYearly * AvailableBonus *CompanyPerformance)/20),(Yearly * AvailableBonus * CompanyPerformance)/10) AS `Bonus' FROM EmployeeBonus, BonusParameters

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 134You use Microsoft SQL Server 2012 to develop a database application. You need to create an object that meets the following requirements.- Takes an input parameter.- Returns a table of values.- Can be referenced within a view.Which object should you use?

A. inline table-valued function

B. user-defined data type

C. stored procedure

D. scalar-valued function

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Incorrect answers:Not B: A user-defined data type would not be able to take an input parameter.

Page 149: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Not C: A stored procedure cannot be used within a view.Not D: A scalar-valued would only be able to return a single simple value, not a table.

QUESTION 135HOTSPOTYou are designing an order entry system that uses an SQL Server database. The database includes the following tables:

You need to ensure that Orders are added to the Orders table only for customers that have an account balance of zero.

How should you complete the relevant Transact-SQL statement? To answer, select the correct Transact-SQL statement from each list in the answer area.

Hot Area:

Page 150: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 151: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 152: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Explanation:The Transact SQL CREATE TRIGGER command creates a DML, DDL, or logon trigger. A trigger is a special kind of stored procedure that automatically executeswhen an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DMLevents are INSERT, UPDATE, or DELETE statements on a table or view. These triggers fire when any valid event is fired, regardless of whether or not any tablerows are affected.

Partial syntax is:CREATE TRIGGER [ schema_name . ]trigger_name ON { table | view } [ WITH <dml_trigger_option> [ ,...n ] ]{ FOR | AFTER | INSTEAD OF } { [ INSERT ] [ , ] [ UPDATE ] [ , ] [ DELETE ] }

Reference: CREATE TRIGGER (Transact-SQL)https://msdn.microsoft.com/en-us/library/ms189799.aspx

QUESTION 136HOTSPOTYou are developing an SQL Server database for an automobile manufacturer. The manufacturer maintains the list of vehicles sold and vehicles that have beenrecalled. The tables are shown below:

You have the following Transact-SQL code. Line numbers are included for reference only.

Page 153: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You must update the VehiclesToRecall table with the list of vehicles that were recalled in 2014. You must maximize the performance of the operation.

For each of the following statements, select Yes if the statement is true. Otherwise, select No.

Hot Area:

Page 154: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 155: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Reference: MERGE (Transact-SQL)https://msdn.microsoft.com/en-us/library/bb510625.aspx

QUESTION 137You are developing a Microsoft SQL Server 2012 database for a company. The database contains a table that is defined by the following Transact-SQL statement.

You use the following Transact-SQL script to insert new employee data into the table. Line numbers are included for reference only.

Page 156: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

If an error occurs, you must report the error message and line number at which the error occurred and continue processing errors. You need to complete theTransact-SQL script. Which Transact- SQL segment should you insert at line 06?

A. SELECT ERROR_LINE(), ERROR_MESSAGE()

B. DECLARE @message NVARCHAR(1000),@severity INT, @state INT; SELECT @message = ERROR_MESSAGE(), @severity = ERROR_SEVERITY(),@state = ERROR_STATE();RAISERROR (@message, @severity, @state);

C. DECLARE @message NVARCHAR(1000),@severity INT, @state INT; SELECT @message = ERROR_MESSAGE(), @severity = ERROR_SEVERITY(),@state = ERROR_STATE();THROW (@message, @severity, @state);

D. THROW;

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:When the code in the CATCH block finishes, control passes to the statement immediately after the END CATCH statement. Errors trapped by a CATCH block arenot returned to the calling application. If any part of the error information must be returned to the application, the code in the CATCH block must do so by usingmechanisms such as SELECT result sets or the RAISERROR and PRINT statements.Reference: TRY... CATCH (Transact-SQL)https://msdn.microsoft.com/en-us/library/ms175976.aspx

QUESTION 138HOTSPOTYou are developing an SQL Server database. The database contains two tables and a function that are defined by the following Transact-SQL statements.

Page 157: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Page 158: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to create a query to determine the total number of products that are sold each day for the live top-selling products on that particular day.

How should you complete the relevant Transact-SQL script? To answer, select the appropriate Transact-SQL statements from each list in the answer area.

Hot Area:

Page 159: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 160: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

Page 161: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

The APPLY operator allows you to invoke a table-valued function for each row returned by an outer table expression of a query. TThere are two forms of APPLY: CROSS APPLY and OUTER APPLY. CROSS APPLY returns only rows from the outer table that produce a result set from the table-valued function. OUTER APPLY returns both rows that produce a result set, and rows that do not, with NULL values in the columns produced by the table-valuedfunction.

Reference: Using APPLYhttps://technet.microsoft.com/en-us/library/ms175156(v=sql.105).aspx

QUESTION 139You are maintaining a Microsoft SQL Server database. You run the following query.

You observe performance issues when you run the query. You capture the following query execution plan.

Page 162: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to ensure that the query performs returns the results as quickly as possible. Which action should you perform?

A. Add a new index to the ID column of the Person table.

B. Add a new index to the EndDate column of the History table.

C. Create a materialized view that is based on joining data from the ActiveEmployee and History tables.

D. Create a computed column that concatenates the GivenName and SurName columns.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Cost is 53% for the Table Scan on the Person (p) table. This table scan is on the ID column, so we should put an index on it.

QUESTION 140DRAG DROPYou develop an SQL Server database. The database contains a table that is defined by the following T-SQL statements:

Page 163: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

The table contains duplicate records based on the combination of values in the surName, givenName, and dateOfBirth fields.

You need to remove the duplicate records.

How should you complete the relevant Transact-SQL statements? To answer, drag the appropriate code segment or segments to the correct location or locations inthe answer area. Each code segment may be used once, more than once, or not at all. You may need to drag the split bar between panes or scroll to view content.

Select and Place:

Page 164: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer:

Page 165: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:Example:let us write a query which will delete all duplicate data in one shot. We will use a CTE (Common Table Expression) for this purpose. We will read in future postswhat a CTE is and why it is used. On a lighter note, CTE's can be imagined as equivalent to temporary result sets that can be used only in an underlying SELECT,INSERT, UPDATE, DELETE or CREATE VIEW statement.;WITH CTE AS(SELECT Name , City , [State] , ROW_NUMBER() OVER(PARTITION BY Name, City, [State] ORDER BY [Name]) AS RnumFROM Persons)DELETE FROM CTE WHERE Rnum <> 1

In the code by saying WHERE Rnum <> 1, we are asking SQL Server to keep all the records with Rank 1, which are not duplicates, and delete any other record.After executing this query in SQL Server Management Studio, you will end up with no duplicates in your table. To confirm that just run a simple query against yourtable.

Reference: How to Remove Duplicates from a Table in SQL Serverhttp://social.technet.microsoft.com/wiki/contents/articles/22706.how-to-remove-duplicates-from-a-table-in-sql-server.aspx

QUESTION 141You are developing a database in SQL Server 2012 to store information about current employee project assignments. You are creating a view that uses data fromthe project assignment table. You need to ensure that the view does not become invalid if the schema of the project assignment table changes. What should youdo?

A. Create the view by using an account in the sysadmin role.

B. Add a DDL trigger to the project assignment table to re-create the view after any schema change.

C. Create the view in a new schema.

D. Add a DDL trigger to the view to block any changes.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:

Page 166: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

DDL triggers are a special kind of trigger that fire in response to Data Definition Language (DDL) statements. They can be used to perform administrative tasks inthe database such as auditing and regulating database operations.Reference: DDL Triggershttps://technet.microsoft.com/en-us/library/ms190989(v=sql.105).aspx

QUESTION 142You are maintaining a Microsoft SQL Server database that stores order information for an online store website. The database contains a table that is defined by thefollowing Transact-SQL statement.

You need to ensure that purchase order numbers are used only for a single order. What should you do?

Page 167: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Create a new CLUSTERED constraint on the PurchaseOrderNumber column.

B. Create a new UNIQUE constraint on the PurchaseOrderNumber column.

C. Create a new PRIMARY constraint on the PurchaseOrderNumber column.

D. Create a new FOREIGN KEY constraint on the PurchaseOrderNumber column.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:You can use UNIQUE constraints to make sure that no duplicate values are entered in specific columns that do not participate in a primary key. Although both aUNIQUE constraint and a PRIMARY KEY constraint enforce uniqueness, use a UNIQUE constraint instead of a PRIMARY KEY constraint when you want to enforcethe uniqueness of a column, or combination of columns, that is not the primary key.Reference: UNIQUE Constraintshttps://technet.microsoft.com/en-us/library/ms191166(v=sql.105).aspx

QUESTION 143You have a database that contains a table named Customer. The customer table contains a column named LastName that has a column definition of varchar(50). An application named App1 reads from the table frequently. You need to change the column definition to nvarchar(100). The solution must minimize the amount of time it takes for App1 to read the data. Which statement should you execute?

A.

B.

C.

Page 168: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:To change the data type of a column in a SQL Server (or Microsoft access) table, use the following syntax:ALTER TABLE table_nameALTER COLUMN column_name datatypehttps://www.w3schools.com/SQl/sql_alter.asp

QUESTION 144You are maintaining a SQL Server database that uses the default settings. The database contains a table that is defined by the following Transact-SQL statement.

You must write a query that returns the AddressLine1, AddressLine2, and Region fields separated by carriage returns. You must return an empty string for any nullvalues.

Page 169: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A.

B.

C.

D.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Char(13) is a carriage return. Use the IIF construct to return an empty string for NULL values of the Adressline2 column. IIF returns one of two values, depending onwhether theBoolean expression evaluates to true or false in SQL Server.https://msdn.microsoft.com/en-us/library/hh213574.aspx

QUESTION 145A 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 areport 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 Territory ORDER BY Year) AS PreviousYearProfit FROM Profits

B. SELECT Territory, Year, Profit, LAG(Profit, 1, 0) OVER (PARTITION BY Year ORDER BY Territory) AS PreviousYearProfit FROM Profits

C. SELECT Territory, Year, Profit, LAG(Profit, 1, 0) OVER (PARTITION BY Territory ORDER BY Year) AS PreviousYearProfit FROM Profits

D. SELECT Territory, Year, Profit, LEAD(Profit, 1, 0) OVER (PARTITION BY Year ORDER BY Territory) AS PreviousYearProfit FROM Profits

Correct Answer: CSection: (none)

Page 170: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

http://www.gratisexam.com/

Page 171: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Actualtest 2014 Bonus

QUESTION 1You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database named ProductsDB. The relevant part of the ProductsDB is shownin the following database diagram:

You need to write a Transact-SQL query that display a single row in the following XML format:

<row ProductID="1001" Product="Product Name", Price="24.99" InStock="16" Supplier="Company Name" Contact="Contact Name" Phone="346 959 2215" />

Which of the following SELECT statement would you write?

A. SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock], CompanyName AS [Supplier], ContactName AS [Contact],Phone FROM ProductsINNER JOIN Suppliers ON SupplierID = SupplierIDWHERE ProductID = 1001FOR XML RAW

B. SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock], CompanyName AS [Supplier], ContactName AS [Contact],Phone FROM ProductsINNER JOIN Suppliers ON SupplierID = SupplierIDWHERE ProductID = 1001FOR XML

C. SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock], CompanyName AS [Supplier], ContactName AS [Contact],Phone FROM ProductsINNER JOIN Suppliers ON SupplierID = SupplierIDWHERE ProductID = 1001FOR XML AUTO

D. SELECT ProductID, ProductName AS [Product], UnitPrice AS [Price], UnitsInStock AS [InStock], CompanyName AS [Supplier], ContactName AS [Contact],Phone FROM ProductsINNER JOIN Suppliers ON SupplierID = SupplierIDWHERE ProductID = 1001FOR XML AUTO, RAW

Correct Answer: ASection: (none)

Page 172: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:Explanation:

QUESTION 2You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB. The SalesDB is shown in the following databasediagram:

You need to write a Transact-SQL query that display a single row in the following XML format:

<Invoices InvoiceID="1001" Date="2012-10-01T00:00:00", Value="1000.00" Customer="Customer Name" ShippedTo="Customer City" />

Which of the following SELECT statement would you write?

Page 173: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

http://www.gratisexam.com/

A. SELECT in.InvoiceID, in.InvoiceDate AS [Date], in.InvoiceValue AS [Value], cu.CustomerName AS [Name], cu.CustomerCity AS [ShippedTo] FROM Invoices ASin INNER JOIN Customers AS cu ON in.CustomerID = cu.CustomerID WHERE cu.CustomerID = 1001FOR XML RAW

B. SELECT InvoiceID, InvoiceDate AS [Date], InvoiceValue AS [Value], CustomerName AS [Name], CustomerCity AS [ShippedTo] FROM InvoicesINNER JOIN Customers ON Invoices.CustomerID = Customers.CustomerID WHERE Customers.CustomerID = 1001FOR XML

C. SELECT Invoices.InvoiceID, Invoices.InvoiceDate AS [Date], Invoices.InvoiceValue AS [Value], Customers.CustomerName AS [Name],Customers.CustomerCity AS [ShippedTo] FROM Invoices INNER JOIN Customers ON Invoices.CustomerID = Customers.CustomerID WHERECustomers.CustomerID = 1001FOR XML AUTO

D. SELECT InvoiceID, InvoiceDate AS [Date], InvoiceValue AS [Value], CustomerName AS [Name], CustomerCity AS [ShippedTo] FROM InvoicesINNER JOIN Customers ON Invoices.CustomerID = Customers.CustomerID WHERE Customers.CustomerID = 1001FOR XML AUTO, RAW

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 3You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database named ProductsDB. The ProductsDB database is shown in thefollowing database diagram:

Page 174: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to write a Transact-SQL query that displays all the products received by a single supplier in the following XML format:

<Suppliers SupplierID="22" Company="Company Name" ContactNumber="510 250 6400">

<Products ProductID="100" UnitPrice="249.00" UnitsInStock="7" />

<Products ProductID="118" UnitPrice="559.00" UnitsInStock="12" />

</Suppliers>

Which of the following SELECT statement would you write?

A. SELECT s.SupplierID, s.CompanyName AS [Company], s.ContactNumber, p.ProductID,

B. UnitPrice, p.UnitsInStockFROM Suppliers AS sINNER JOIN Products AS p ON s.SupplierID = p.SupplierID WHERE s.SupplierID = 22FOR XML RAW

C. SELECT s.SupplierID, s.CompanyName AS [Company], s.ContactNumber, p.ProductID,

D. UnitPrice, p.UnitsInStockFROM Suppliers AS sINNER JOIN Products AS p ON s.SupplierID = p.SupplierID WHERE s.SupplierID = 22FOR XML

E. SELECT Suppliers.SupplierID, Suppliers.CompanyName AS [Company], Suppliers.ContactNumber, Products.ProductID, Products.UnitPrice,Products.UnitsInStock FROM SuppliersINNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID WHERE Suppliers.SupplierID = 22FOR XML AUTO

F. SELECT Suppliers.SupplierID, Suppliers.CompanyName AS [Company], Suppliers.ContactNumber, Products.ProductID, Products.UnitPrice,Products.UnitsInStock FROM Suppliers

Page 175: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

INNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID WHERE Suppliers.SupplierID = 22FOR XML AUTO, RAW

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 4CORRECT TEXT

You work as a SQL Server 2012 database developer at ABC.com. You are developing a query for a database driven Web application that allows visitors to vote forthe cricket player of the week. The number of votes is stored in a table named WeeklyVotes that has columns named Week, PlayerName, Votes.

You need to write a Transact-SQL query that ranks the top 30 cricket players by the average votes over the last 12 months. You want the top 10 cricket players tohave a rank of 1, the next 10 to have a rank of 2, and the last 10 to have a rank of 3.

Which of the following SELECT statement would you use?

To answer, type the correct code in the answer area.

Correct Answer: SELECT TOP 30 PlayerName, NTILE (3) OVER (ORDER BY AVG (Votes) DESC) AS AveVotes FROM WeeklyVotes GROUP BY PlayerNameSection: (none)Explanation

Explanation/Reference:

QUESTION 5You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB that has a table named WeeklySales. TheWeeklySales table records the sales amount for each of ABC.com's 20 sales representatives.

You need to write a Transact-SQL query that ranks the sales representatives by the average sales amount for the past year. You want the sales representativeswith the same average sales amount to have the same rank with the subsequent rank being skipped.

Which ranking function should you use?

A. The RANK( ) OVER function.

B. The NTILE( ) OVER function

Page 176: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. The DENSE_RANK( ) OVER function

D. The ROW_NUMBER( ) OVER function

E. The FORMAT function.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms189798.aspx

QUESTION 6You work as a SQL Server 2012 database developer at ABC.com. You are developing a query for a database driven Web application that allows visitors to vote forthe cricket player of the week. The number of votes is stored in a table named WeeklyVotes that has columns named Week, PlayerName, Votes.

You need to write a Transact-SQL query that returns the cricket player that received the most votes for each week, as well as the number of votes they received.

Which of the following SELECT statement would accomplish this task?

A. SELECT PlayerName, VotesFROM ( SELECT PlayerName, Votes,RANK () OVER (PARTITION BY PlayerName ORDER BY Votes ASC) AS Rank FROM WeeklyVotes ) AS tmpWHERE Rank = 1

B. SELECT PlayerName, VotesFROM ( SELECT PlayerName, Votes,RANK() OVER (PARTITION BY Week ORDER BY Votes DESC) AS Rank FROM WeeklyVotes) AS tmpWHERE Rank = 1

C. SELECT PlayerName, VotesFROM ( SELECT TOP 1 PlayerName, Votes,RANK () OVER (PARTITION BY PlayerName ORDER BY Votes ASC) AS Rank FROM WeeklyVotesORDER BY Rank) AS tmp

D. SELECT PlayerName, VotesFROM ( SELECT TOP 1 PlayerName, Votes,RANXO OVER (PARTITION BY PlayerName ORDER BY Votes DESC) AS Rank FROM WeeklyVotesORDER BY Rank) AS tmp

Correct Answer: BSection: (none)Explanation

Page 177: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:

QUESTION 7You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB that has a table named Inventory.

The Inventory table has three columns named ProductID, InStore and InWarehouse. The ProductID column is the primary key and is linked to the Products table.The InStore column stores the quantity of a product that is held at ABC.com's retail shop, while the InWarehouse column stores the quantity of a product that is heldat ABC.com's warehouse.

You need to add a computed column that stores the total number of a product that ABC.com has.

What Transact-SQL statements would accomplish this task?

A. ALTER TABLE InventoryADD TotalProducts AS (InStore + InWarehouse) PERSISTED

B. ALTER TABLE InventoryADD TotalProducts int SPARSE NOT NULL

C. ALTER TABLE InventoryADD TotalProducts AS SUM (ALL) OVER (GROUP BY InStore, InWarehouse) PERSISTED

D. DROP TABLE InventoryGOCREATE TABLE Inventory(ProductID int NOT NULL PRIMARY KEY,InStore int NOT NULL,InWarehouse int NOT NULL,TotalProducts AS SUM (InStore, InWarehouse) PERSISTED )

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://www.kodyaz.com/articles/sql-server-computed-column-calculated-column-sample.aspx

QUESTION 8ABC.com has a SQL Server 2012 database instance that hosts a database named ComDB. The ComDB database has a table named Partners that was createdusing the following Transact-SQL code:

Page 178: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

CREATE TABLE [dbo].[Partners]

(

[CompanyID] [int] NOT NULL,

[CompanyName] [nvarchar] (50) NOT NULL,

[Location] [nvarchar] (50) NOT NULL,

[ContactName] [nvarchar] (50) NOT NULL,

[Email] [nvarchar] (50) NOT NULL,

[Phone] [nvarchar] (10) NOT NULL,

CONSTRAINT [PK_Partners] PRIMARY KEY CLUSTERED

(

[CompanyID] ASC

)

ON PRIMARY)

You want to create a FOR UPDATE trigger that will track changes to the ContactName and Phone columns.

Which of the following statements should you use in the trigger definition?

A. IF COLUMNS_UPDATED (ContactName, Phone)

B. IF COLUMNS_UPDATED (ContactName) OR COLUMNS_UPDATED (Phone)

C. IF UPDATED (ContactName, Phone).

D. IF UPDATED (ContactName) OR UPDATED (Phone)

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 179: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation:

QUESTION 9You are the database administrator of a SQL Server 2012 database infrastructure at ABC.com.

You need to optimize a very large database table that contains several million rows of data by designing a view based on the table. The view must allow users toperform aggregations on several columns.

How should you configure the view to ensure optimal performance?

A. You should create the view as an indexed view.

B. You should create a clustered index on the view.

C. You should make use of a stored procedure to return that data.

D. You should make use of a table-valued function.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 10You are the database developer at ABC.com. ABC.com has a SQL Server 2012 database infrastructure that has a database named ComDB with a table namedPartners.

The Partners table was created using the following Transact-SQL code:

CREATE TABLE [dbo].[Partners]

(

[CompanyID] [int] NOT NULL PRIMARY KEY,

[CompanyName] [varchar] (150) NOT NULL,

[Location] [varchar] (150) NOT NULL,

[ContactName] [varchar] (150) NOT NULL,

Page 180: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

[Email] [varchar] (150) NOT NULL,

[Phone] [varchar] (10) NOT NULL

)

You develop a new table named Events using the following Transact-SQL code:

CREATE TABLE [dbo].[Events]

(

[EventID] [int] NOT NULL PRIMARY KEY,

[CompanyID] [int] NOT NULL,

[EventDescription] [varchar] (2500),

[EventCordinator] [varchar] (150) NOT NULL

)

How would you guarantee that values in the Events.CompanyID column already exist in the Partners.CompanyID column?

A. You should add a Foreign Key Constraint on the Events table.

B. You should add a Check Constraint on the Events table.

C. You should add a Unique Constraint on the Events table.

D. You should specify Events.CompanyID as a spars column.

E. You should change the Events table to a partitioned table.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms179610.aspx

QUESTION 11ABC.com has a SQL Server 2012 database infrastructure that has a database named ComDB.

Page 181: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You have created a view using the following Transact-SQL code:

CREATE VIEW ABCCommunications

(Type, CompanyID, CompanyName, Location, ContactName, Email, Phone)

AS

SELECT 'Clients' AS Type, CompanyID, CompanyName, Location, ContactName, Email, Phone

FROM CommList

WHERE Relation = 'Client'

SELECT 'Partners' AS Type, CompanyID, CompanyName, Location, ContactName, Email, Phone

FROM CommList

WHERE Relation = 'Partner'

SELECT 'Guests' AS Type, CompanyID, CompanyName, Location, ContactName, Email, Phone

FROM CommList

WHERE Relation = 'Guests'

GO

You want the view to be used to edit all columns except the CompanyID, CompanyName and Location columns.

What should you implement on the view?

A. You should consider implementing an AFTER UPDATE trigger.

B. You should consider implementing an Index.

C. You should consider implementing an INSTEAD OF UPDATE trigger.

D. You should consider implementing a CHECK constraint.

Correct Answer: CSection: (none)Explanation

Page 182: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

Explanation:

QUESTION 12You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB. The SalesDB database is shown in the followingdatabase diagram:

You create a view on the SalesDB using the following Transact-SQL code:

CREATE VIEW SalesV

WITH SCHEMABINDINGS

AS

SELECT Products.ProductID, Invoices.InvoiceDate, SUM (Products.RetailPrice * OrderDetail.Quantity * OrderDetail.SalesDiscount) AS Price

FROM OrderDetail INNER JOIN Products ON

Page 183: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

OrderDetail.ProductID = Products.ProducID

INNER JOIN Invoices ON

OrderDetail.InvoiceID = Invoices.InvoiceID

GROUP BY Products.ProductID, Invoices.InvoiceDateGO

How should you alter this view to allow users to update data through the SalesV?

A. You should add a CHECK constraint to the SalesV view.

B. You should add an INSTEAD OF trigger to the SalesV view.

C. You should add a clustered index to the SalesV view.

D. You should add an AFTER UPDATE trigger to the SalesV view.

E. Create a columnstore index on all columns used in the SalesV view.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 13CORRECT TEXT

You are employed as a SQL Server 2012 database developer at ABC.com. ABC.com has a SalesDB database with a view named SalesV. The SalesV view was created using the following Transact-SQL code:

CREATE VIEW SalesDB.ProductsSalesV

AS

SELECT OrderID, ProductID, ShipDate, OrderDate, Amount

FROM SalesDB.Orders;

You want to create an inline table-valued function named fn_ABC that accepts a @ProductID parameter of the integer data type. The inline table-valued functionshould also allow for sales orders for each product to be listed by the latest sale.

Page 184: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

How would you create this inline table-valued function?

To answer, type the correct code in the answer area.

Correct Answer: CREATE FUNCTION SalesDB.fn_ABC ( @ProductID int ) RETURNS TABLE AS RETURN ( SELECT OrderID, ProductID, ShipDate, OrderDate,Amount FROM Sales. ProductsSalesV WHERE ProductID = @ProductID ORDER BY OrderDate DESC );Section: (none)Explanation

Explanation/Reference:

QUESTION 14CORRECT TEXT

You are employed as a SQL Server 2012 database developer at ABC.com. ABC.com has a database named SalesDB with tables named Customer and Orders.The Customer and Orders tables were created using the following Transact-SQL code:

CREATE TABLE SalesDB.Customers

(

CustomerID int NOT NULL PRIMARY KEY,

FirstName varchar (150) NOT NULL,

LastName varchar (150) NOT NULL,

Address1 varchar (200) NOT NULL,

Address2 varchar (200) NULL,

City varchar (100) NOT NULL,

StateCode varchar (2) NOT NULL,

Zip varchar (5) NOT NULL,

Phone varchar (10) NOT NULL

)

Page 185: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

GO

CREATE TABLE SalesDB.Orders

(

OrderID int NOT NULL PRIMARY KEY,

CustomerID int NOT NULL,

OrderDate datetime NOT NULL,

ShipDate datetime NOT NULL,

"Pass Any Exam. Any Time." - www.actualtests.com 14 Microsoft 70-461 ExamCustomerID int NOT NULL,

SalesRepID int NOT NULL

)

GO

You must now create an OrderDetails table as shown in the following database diagram:

The TotalPrice column must be a computed column based on the product of the UnitPrice and Quantity columns and the data must be stored in the table.

How would you create this table?

To answer, type the correct code in the answer area.

A.

B.

C.

Page 186: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D.

Correct Answer: Section: (none)Explanation

Explanation/Reference:Answer: CREATE TABLE SalesDB.OrderDetails(OrderID int NOT NULL,ProductID int NOT NULL,Quantity int NOT NULL,UnitPrice money NOT NULL,TotalPrice AS (Quantity * UnitPrice) PERSISTED)

QUESTION 15You work as a SQL Server 2012 database developer at ABC.com. ABC.com has a database named SalesDB.

You are developing a stored procedure that takes a parameter named @date that uses the varchar datatype. The @date parameter must be compared to the valuein a datetime column named OrderDate.

Which of the following WHERE clauses would be the most efficient WHERE clause to use?

http://www.gratisexam.com/

A. WHERE OrderDate = CAST(datetime,@date)

B. WHERE OrderDate = CONVERT(datetime,@date)

C. WHERE OrderDate =@date

D. WHERE OrderDate = CAST(@date AS datetime)

E. WHERE OrderDate = PARSE(@date AS Date)

Correct Answer: CSection: (none)Explanation

Page 187: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:

QUESTION 16You work as a database developer at ABC.com. You want to create a Transact-SQL query will call a table-valued function for every row the query returns.

How would you accomplish this task?

A. You should make use of a UNION.

B. You should make use of a CONVERT function.

C. You should make use of an INNER JOIN.

D. You should make use of a Trigger.

E. You should make use of a CAST function.

F. You should make use of an OUTER JOIN.

G. You should make use of a CROSS APPLY.

H. You should make use of the FORMAT function.

Correct Answer: GSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 17Which of the following datatypes has a fixed precision and a scale of six digits?

A. Double

B. Money

C. Int

D. Numeric

E. SmallInt

F. VarInt

G. Float

Correct Answer: DSection: (none)Explanation

Page 188: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:

QUESTION 18You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB as illustrated in the following database diagram:

ABC.com has retail stores in a few major cities across the country. The company wants a list of Customers who live in a city that does not have a ABC.com store,along with the customer's City. The result set must be sorted alphabetically by City name.

Which of the following Transact-SQL statements would return the required information?

A. SELECT CustomerName, CustomerCityFROM CustomersWHERE CustomerCity NOT EXISTS (SELECT StoreCity FROM Stores) ORDER BY CustomerCity

B. SELECT CustomerName, CustomerCityFROM CustomersWHERE CustomerCity < > ALL (SELECT StoreCity FROM Stores) ORDER BY StoreCity

C. SELECT CustomerName, CustomerCityFROM CustomersWHERE CustomerCity < > ANY (SELECT StoreCity FROM Stores) ORDER BY CustomerCity

Page 189: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D. SELECT CustomerName, CustomerCityFROM CustomersWHERE CustomerCity NOT IN (SELECT StoreCity FROM Stores) ORDER BY StoreCity

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 19You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database infrastructure with several databases. You have permissions on two ofthese databases, namely, CommDB and SalesDB.

You need to develop a stored procedure named dbo.ABC_addEntry in a database named AssetsDB. The dbo.ABC_addEntry stored procedure will run storedprocedures in CommDB and SalesDB.

How should you design the stored procedure so that callers that do not paver permissions on CommDB and SalesDB can run the dbo.ABC_addEntry storedprocedure successfully?

A. You should configure the stored procedure to call the xp_cmdshell extended stored procedure.

B. You should configure the stored procedure to call the sp_configure system stored procedure.

C. You should assign users permission to the stored procedure.

D. You should include the EXECUTE AS CALLER clause when creating the stored procedure.

E. You should include the EXECUTE AS OWNER clause when creating the stored procedure.

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 20CORRECT TEXTYou are the database developer at ABC.com. ABC.com has a SQL Server 2012 database infrastructure that has a database named ComDB with tables namedPartners and Events. These tables were created using the following Transact-SQL code:

CREATE TABLE [dbo].[Partners]

Page 190: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

(

[CompanyID] [int] NOT NULL PRIMARY KEY,

[CompanyName] [varchar] (150) NOT NULL,

[Location] [varchar] (150) NOT NULL,

[ContactName] [varchar] (150) NOT NULL,

[Email] [varchar] (150) NOT NULL,

[Phone] [varchar] (10) NOT NULL

)

CREATE TABLE [dbo].[Events]

(

[EventID] [int] NOT NULL PRIMARY KEY,

[CompanyID] [int] NOT NULL,

[EventDescription] [nvarchar] (MAX),

[EventDate] [nvarchar] (50) NOT NULL,

[EventCordinator] [nvarchar] (150) NOT NULL

)

You add a foreign key relationship between the two tables on the CompanyID column.

You need to develop a stored procedure named sp_coEvents that retrieves CompanyName for all partners and the EventDate for all events that they havecoordinated.

To answer, type the correct code in the answer area.

Correct Answer: CREATE PROCEDURE sp_coEvent AS SELECT CompanyName, EventDate FROM Partners JOIN Events ON Partners.CompanyID =Events.CompanyIDSection: (none)

Page 191: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 21You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database infrastructure with a very large database named SalesDB. You create a new table named SalesHistory that will hold historical data from the SalesDB database.

You need to perform a batch update from the SalesDB database to the SalesHistory table. You want the status information from the batch process to be logged to a SQL Server table that must be created by the batch process.

How would you accomplish this task?

A. You should make use of the FORMAT function.

B. You should make use of the CONVERT function.

C. You should make use of a scalar user-defined function.

D. You should make use of an inline function.

E. You should make use of a table-valued function.

F. You should make use of a stored procedure.

Correct Answer: FSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 22You are developing a SQL Server 2012 database for ABC.com. You need to create a computed column that returns the data by referencing another table using anINNER JOIN.

How would you accomplish this?

A. You should make use of the FORMAT function.

B. You should make use of a scalar user-defined function.

C. You should make use of an inline function.

D. You should make use of a table-valued user-defined function.

E. You should make use of a stored procedure.

Page 192: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 23Which of the following statements regarding SQL Server 2012 objects is TRUE?

A. A user-defined data type can accept an input variable and return a table of results but cannot be used within a view.

B. A scalar function can accept an input variable and return a table of results but cannot be used within a view.

C. A table-valued function can accept an input variable and return a table of results but cannot be used within a view.

D. A table-valued type can accept an input variable and return a table of results but cannot be used within a view.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 24You work as a SQL Server 2012 database developer at ABC.com. TesABCig.com has a database named DataDB.

You are developing a complex stored procedure named sp_updater that will use a single transaction to update several tables in the DataDB database.

You are concerned about data integrity and incomplete updates should the sp_updater stored procedure cause a run-time error.

To mitigate this potential problem you want the transaction to terminate and the transaction to be rolled back if the sp_updater stored procedure raises a run-timeerror.

How would you accomplish this task?

A. You should make use of the SET XACT_ABORT ON statement in the stored procedure.

B. You should have the stored procedure run in the SERIALIZABLE ISOLATION LEVEL.

C. You should make use of a LOOP hint in the stored procedure.

D. You should have the stored procedure run in the SNAPSHOT ISOLATION LEVEL.

E. You should make use of an INSTEAD OF UPDATE trigger in the stored procedure.

Page 193: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms188792

QUESTION 25You work as a SQL Server 2012 database developer at ABC.com.

ABC.com has a database SalesDB with a large Orders table. You create a heap named OldData that will store historical data from the Orders table.

You need to write a Transact-SQL query that will insert rows of data from the Orders table that are marked as closed and are more than six months old.

Which of the following table hints should you use in your query if you want to optimize transaction logging and locking for the query?

A. You should make use of the READPAST hint.

B. You should make use of the HOLDLOCK hint.

C. You should make use of the READCOMMITTED hint.

D. You should make use of the NOLOCK hint.

E. You should make use of the TABLOCK hint.

F. You should make use of the UPDLOCK hint.

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 26You are employed as a SQL Server 2012 database developer at ABC.com. You have a stored procedure that is executed quite often. The stored procedure joinsdata from two tables.

ABC.com users report that the stored procedure takes a long time to execute. You analyze the

query plan and find that the stored procedure often makes use of table scans rather than indexes when the estimated rows do not match the actual rows on one ofthe tables.

How would you optimize the performance of the stored procedure?

Page 194: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. You should make use of the KEEPIDENTITY table hint in the stored procedure.

B. You should make use of the KEEPDEFAULTS table hint in the stored procedure.

C. You should make use of the IGNORE_CONSTRAINTS table hint in the stored procedure.

D. You should make use of the FORCESEEK table hint in the stored procedure.

E. You should update statistics on the tables queried by the stored procedure.

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 27You work as a SQL Server 2012 database developer at ABC.com. You are developing a database driven Web application. The application executes a store procedure based on the location of the web user.

The location of the Web user is determined by IP Geolocation. You want to develop a process that will execute the correct stored procedure for every Web userbased on the user's location.

How would you accomplish this?

http://www.gratisexam.com/

A. You should make use of a foreach SQLCLR statement.

B. You should make use of a scalar user-defined function.

C. You should make use of an inline function.

D. You should make use of a cursor.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 195: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation:

QUESTION 28You work as a SQL Server 2012 database administrator at ABC.com. You have developing a database named WebAnDB that will be used by a web site analysisapplication. The WebAnDB database has a table named Visitors that stores date and time data in a column named Accessed.

You must now develop a stored procedure that will insert data into the Accessed column. You want the stored procedure to store time zone data as well.

How would you accomplish this?

A. You should make use of a scalar user-defined function.

B. You should make use of the SET CONTEXT_INFO statement in the stored procedure.

C. You should make use of the DATETIMEOFFSET data type.

D. You should make use of the TODATETIMEOFFSET function.

E. You should make use of the SET FORCEPLAN ON statement in the stored procedure.

F. You should make use of a cursor.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 29You work as a SQL Server 2012 database developer at ABC.com.

You are developing a database that will be used by a Web application. The database will store small multimedia files in several tables. The largest multimedia file is975 kB. These multimedia files will be retrieved quite often.

How would you store these files?

A. You should make use of a cursor.

B. You should make use of a row-level compression.

C. You should make use of the FileStream data type.

D. You should make use of the VARBINARY data type.

Correct Answer: DSection: (none)Explanation

Page 196: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:

QUESTION 30You work as a database administrator at ABC.com. You are developing a database that will be used by a web site analysis application name ABCWeb1.

The ABCWeb1 application must display the date and time each visitor visits a page on a website as well as the date and time they leave that web page. This data needs to be displayed in different date and time formats.

How would you accomplish this?

A. You should make use of a scalar user-defined function.

B. You should make use of the SET CONTEXT_INFO statement in the stored procedure.

C. You should make use of the DATETIMEOFFSET data type.

D. You should make use of the FORMAT function.

E. You should make use of the SET FORCEPLAN ON statement in the stored procedure.

F. You should make use of a cursor.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 31You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB that has a table named Inventory.

The Inventory table has three columns named ProductID, InStore and InWarehouse. The ProductID column is the primary key and is linked to the Products table.The InStore column stores the quantity of a product that is held at ABC.com's retail shop, while the InWarehouse column stores the quantity of a product that is heldat ABC.com's warehouse.

You need to add a computed column that is the sum of values in the InStore and InWarehoue columns for each product.

What Transact SQL statement would accomplish this task?

A. ALTER TABLE InventoryADD TotalProducts AS (InStore + InWarehouse)

B. ALTER TABLE Inventory

Page 197: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

ADD TotalProducts int SPARSE NOT NULL

C. ALTER TABLE InventoryADD TotalProducts AS SUM (ALL) OVER (GROUP BY InStore, InWarehouse)

D. DROP TABLE InventoryGO"Pass Any Exam. Any Time." - www.actualtests.com 25 Microsoft 70-461 ExamCREATE TABLE Inventory(ProductID int NOT NULL PRIMARY KEY,InStore int NOT NULL,InWarehouse int NOT NULL,TotalProducts AS SUM (InStore, InWarehouse))

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://www.kodyaz.com/articles/sql-server-computed-column-calculated-column-sample.aspx

QUESTION 32You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB. The SalesDB database is shown in the followingdatabase diagram:

Page 198: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You create a view on the SalesDB database using the following Transact-SQL code:

CREATE VIEW SalesV

WITH SCHEMABINDINGS

AS

SELECT Products.ProductID, Invoices.InvoiceDate, SUM (Products.RetailPrice * OrderDetail.Quantity * OrderDetail.SalesDiscount) AS Price

FROM OrderDetail INNER JOIN Products ON

OrderDetail.ProductID = Products.ProducID

INNER JOIN Invoices ON

OrderDetail.InvoiceID = Invoices.InvoiceID

GROUP BY Products.ProductID, Invoices.InvoiceDate

Page 199: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

GO

You want the SalesV view to persist data to disk in order to improve performance.

How would you accomplish this task?

A. You should add a clustered index to the SalesV view.

B. You should create a columnstore index on all columns used in the SalesV view.

C. You should drop and recreate the SalesV view as a system view.

D. You should drop and recreate the SalesV view as a partitioned view.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms190174

QUESTION 33You work as a database developer at ABC.com. You need to store Microsoft Word documents in a SQL Server 2012 database table.

The Word documents must not be accessed by Windows applications that do not use Transact- SQL queries.

How would accomplish this task?

A. You should store the documents using the VARBINARY(MAX) datatype.

B. You should store the documents using the VARCHAR(MAX) datatype.

C. You should store the documents using the FILESTREAM datatype.

D. You should store the documents using the NVARCHAR(MAX) datatype.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 34You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB with a table named Invoices.

Page 200: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Application developers are developing several in-house applications that will access the Invoices table. You need to develop a solution that will allow the applications to access the table indirectly while still allowing them to update the Invoice table.

How would you accomplish this task?

A. You should create a view on the Invoices table.

B. You should create a columnstore index on all columns used by the applications.

C. You should allow the applications access to the Invoices table via stored procedures.

D. You should drop and recreate the Invoices table as a partitioned table.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 35You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database

named SalesDB. The SalesDB database is shown in the following database diagram:

Page 201: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You need to write a Transact-SQL query that displays all Customers, whether they have invoices or not. The query must also display the InvoiceDate for a Customer that has an Invoice.

How would you accomplish this task?

A. You should make use of a UNION.

B. You should make use of an INNER JOIN.

C. You should make use of a CROSS JOIN.

D. You should make use of an OUTER JOIN.

E. You should make use of a CROSS APPLY.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:

Page 202: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 36CORRECT TEXT

You are employed as a SQL Server 2012 database developer at ABC.com. ABC.com has a database named HRDB with tables named Staff and SalaryHistory. TheStaff and SalaryHistory tables were created using the following Transact-SQL code:

CREATE TABLE HRDB.Staff

(

StaffID int NOT NULL PRIMARY KEY,

FirstName nvarchar(50) NOT NULL,

LastName nvarchar(50) NOT NULL,

JobTitle nvarchar(50) NOT NULL,

StaffAddress nvarchar (200) NULL,

StaffCity nvarchar(50) NOT NULL,

StaffState nvarchar(50) NOT NULL,

StaffPhone varchar (10) NOT NULL,

Salary smallmoney NOT NULL

)

GO

CREATE TABLE HRDB.SalaryHistory

(

StaffID int NOT NULL,

IncreaseDate date DEFAULT GETDATE(),

PrevSalary smallmoney NOT NULL,

NewSalary smallmoney NOT NULL

Page 203: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

)

GO

You must write a Transact-SQL query to affect a salary increase of 6.5% for all staff members with a JobTitle of Support Technician. Your query must also updatethe data in the SalaryHistory table.

What Transact SQL statement would accomplish this task?

To answer, type the correct code in the answer area.

Correct Answer: UPDATE Staff SET Salary = Salary * 1.065 WHERE JobTitle = 'Support Technician' OUTPUT inserted.StaffID, deleted.Salary, inserted.SalaryINTO SalaryHistory(StaffID, PrevSalary, NewSalary)Section: (none)Explanation

Explanation/Reference:

QUESTION 37You work as a SQL Server 2012 database developer at ABC.com. You are developing a batch process that accepts an input parameter and allows the result set to be joined with a table.

How would you accomplish this?

A. You should make use of a stored procedure to perform the batch process.

B. You should make use of a table-valued user-defined function.

C. You should make use of the SET XACT_ABORT ON statement.

D. You should make use of a scalar user-defined function.

E. You should make use of a schema-bound user-defined function.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:Ref: h http://msdn.microsoft.com/en-us/library/ms191007.aspx

Page 204: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 38You work as a database administrator at manufacturing company named ABC.com. ABC.com has a SQL Server 2012 database named ProductionDB. TheProductionDB database has a table named Sites that was created using the following Transact-SQL code:

CREATE TABLE Sites (

SiteID int NOT NULL PRIMARY KEY,

Location int NOT NULL,

Manager nvarchar(200) NOT NULL,

Week smallint NOT NULL,

ItemsProduced int NOT NULL )

You want to write the Transact-SQL query that returns the number of items produced at each location for each week. In addition, you want the result set to include a column named PrevItemsProduced that holds the number of items produced at each location for the week before.

What Transact SQL statement would accomplish this task?

A. SELECT Location, Week, ItemsProduced,LEAD(ItemsProduced, 1, 0) OVER (PARTITION BY Location ORDER BY Week) AS PrevItemsProducedFROM Sites

B. SELECT Location, Week, ItemsProduced,FIRST_VALUE(ItemsProduced) OVER (PARTITION BY Location ORDER BY Week) AS PrevItemsProducedFROM Sites

C. SELECT Location, Week, ItemsProduced,LAG(ItemsProduced, 1, 0) OVER (PARTITION BY Location ORDER BY Week) AS PrevItemsProducedFROM Sites

D. SELECT Location, Week, ItemsProduced,LAST_VALUE(ItemsProduced) OVER (PARTITION BY Location ORDER BY Week) AS PrevItemsProducedFROM Sites

E. SELECT Location, Week, ItemsProduced,CUME_DIST( ) OVER (PARTITION BY Location ORDER BY Week) AS PrevItemsProduced FROM Sites

Correct Answer: CSection: (none)Explanation

Page 205: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:

QUESTION 39You work as a SQL Server 2012 database developer at ABC.com. You are developing a stored procedure for ABC.com's e-Commerce application.

Your stored procedure must display unique values from one column in multiple columns in the result set.

How would you accomplish this?

A. You should make use of the OUTER APPLY operator.

B. You should make use of a dynamic cursor.

C. You should make use of the PIVOT operator.

D. You should make use of the CROSS APPLY operator.

E. You should make use of the UNPIVOT operator.

F. You should make use of a keyset cursor.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 40You work as a database developer at ABC.com. ABC.com has a SQL Server 2012 database named SalesDB as illustrated in the following database diagram:

Page 206: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

ABC.com has retail stores in a few major cities across the country. The company wants to ascertain whether it would be advantageous to open a store in other citiesbased on feedback from its customers.

You are required to provide the company's CEO with a list of Customers who live in a city that does not have a ABC.com store, along with the customer's PhoneNumber and the customer's City, and arranged alphabetically by City name.

Which of the following Transact-SQL statements would return the required information?

http://www.gratisexam.com/

A. SELECT CustomerName, CustomerCity, CustomerPhoneFROM CustomersWHERE CustomerCity NOT EXISTS (SELECT StoreCity FROM Stores) ORDER BY CustomerCity

B. SELECT CustomerName, CustomerCity, CustomerPhoneFROM CustomersWHERE CustomerCity < > ALL (SELECT StoreCity FROM Stores) ORDER BY StoreCity

C. SELECT CustomerName, CustomerCity, CustomerPhone

Page 207: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

FROM CustomersWHERE CustomerCity < > ANY (SELECT StoreCity FROM Stores) ORDER BY CustomerCity

D. SELECT CustomerName, CustomerCity, CustomerPhoneFROM CustomersWHERE CustomerCity NOT IN (SELECT StoreCity FROM Stores) ORDER BY StoreCity

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 41You work as a database developer at ABC.com. You are developing a SQL server 2012 database for ABC.com's e-Commerce application. The application allows ABC.com employees from different regions to execute a store procedure based on their location.

The location of the ABC.com employees are determined by an input parameter named @location. You want to develop a process that will execute the correct stored procedure for every ABC.com employee based on their location.

How would you accomplish this?

A. You should make use of a client cursor.

B. You should make use of a static cursor.

C. You should make use of a forward-only cursor.

D. You should make use of a dynamic cursor.

E. You should make use of a keyset cursor.

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms191179.aspx

QUESTION 42You work as a SQL Server 2012 database developer at ABC.com. ABC.com has a large database

New rows are inserted into the tables in the SalesDB database and updates to existing rows occur on a high frequency.

Page 208: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

The inserts and updates often blocked by queries retrieving and reading data.

How would you prevent queries that retrieve and read data from blocking queries that insert and update data?

A. You should make use of the SERIALIZABLE ISOLATION LEVEL.

B. You should make use of the SNAPSHOT ISOLATION LEVEL.

C. You should make use of the REPEATABLE READ ISOLATION LEVEL.

D. You should make use of the READCOMMITTED ISOLATION LEVEL.

E. You should make use of the READPAST ISOLATION LEVEL

Correct Answer: BSection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms173763.aspx

QUESTION 43You work as a SQL Server 2012 database developer at ABC.com. You are developing a stored procedure that updates rows in several tables.

You want the entire transaction to be rolled back should the stored procedure cause a run-time error.

How would you accomplish this?

A. You should make use of the SET XACT_ABORT ON statement in the stored procedure.

B. You should have the stored procedure run in the SERIALIZABLE ISOLATION LEVEL.

C. You should make use of a LOOP hint in the stored procedure.

D. You should have the stored procedure run in the SNAPSHOT ISOLATION LEVEL.

E. You should make use of an INSTEAD OF UPDATE trigger in the stored procedure.

F. You should make use of RAISERROR in the stored procedure.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Ref: http://msdn.microsoft.com/en-us/library/ms188792

Page 209: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 44You work as a database developer at ABC.com. ABC has an in-house application named ABCApp3 that runs a Transact-SQL query against a SQL Server 2012database named SalesDB.

ABC.com users report that ABCApp3 is functioning sluggishly. You discover that concurrent updates are causing blockages on the SalesDB database.

How would you ensure that the query to use the original data when updates occur?

A. You should have the query run in the REPEATABLE READ ISOLATION LEVEL.

B. You should have the query run in the SERIALIZABLE ISOLATION LEVEL.

C. You should have the query run in the READCOMMITTED ISOLATION LEVEL.

D. You should have the query run in the SNAPSHOT ISOLATION LEVEL.

E. You should have the query run in the READPAST ISOLATION LEVEL.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 45You work as a database developer at ABC.com. ABC has an in-house application named ABCApp3 that runs a Transact-SQL query against a SQL Server 2012database.

You want to run an execution plan against the query that will provide detailed information on missing indexes.

How would you accomplish this task?

A. You should make use of the READPAST hint in the queries.

B. You should make use of the READCOMMITTED hint in the queries.

C. You should make use of the SET SHOWPLAN_XML ON statement in the query.

D. You should make use of the SET STATISTICS XML ON statement in the query.

E. You should make use of the SET XACT_ABORT OFF statement in the query.

F. You should make use of the SET CONTEXT_INFO statement in the query.

Correct Answer: CSection: (none)Explanation

Page 210: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:Explanation:

QUESTION 46You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database infrastructure that contains a database named SalesDB.

The SalesDB database is used by an in-house application named ABCApp3. ABC.com users report that ABCApp3 is functioning sluggishly.

You discover that application consumes considerable memory when it runs single-use dynamic queries against the SalesDB database. You suspect that thesequeries are making excessive use of procedure cache.

How would you reduce procedure cache if you cannot create new indexes on the SalesDB database?

A. You should replace the queries with recursive stored procedures.

B. You should add make use of the INCLUDE clause in the index.

C. You should make use of the READPAST hint in the queries.

D. You should make use of the READCOMMITTED hint in the queries.

E. You should make use of the optimize for ad hoc workloads option.

Correct Answer: ESection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 47You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database infrastructure that contains a database named ABCDB.

The ABCDB database is used by an in-house application named ABCApp3 that queries a read- only table with a clustered index. ABC.com users report that ABCApp3 is functioning sluggishly.

You suspect query the application uses is causing the problem. You analyze the query and discover that column referenced in the WHERE clause is not part of the clustered index. You also notice that the query returns fivecolumns, as well as a COUNT (*) clause grouped on the five columns.

How would you improve the efficiency of this query?

A. You should replace the query with recursive stored procedure.

B. You should replace the COUNT (*) clause with a persisted computed column.

Page 211: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. You should create nonclustered indexes on all columns used in the query.

D. You should create a filtered index on the column used in the WHERE clause.

E. You should add an INCLUDE clause to the clustered index.

F. You should create a columnstore index on all columns used in the query.

G. You should create a unique clustered index on the column used in the WHERE clause.

Correct Answer: FSection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 48You work as a database administrator at ABC.com. ABC.com has a SQL Server 2012 database named ProductsDB. The ProductsDB database is shown in thefollowing database diagram:

You need to write a Transact-SQL query that displays rows of data in the following XML format:

<Suppliers>

<CompanyName>Company Name</CompanyName>

<ContactName>Contact Name</ContactName>

<Phone>453 3545 5224</Phone>

<Products>

<ProductID>10</ProductID>

<ProductName>Product Name</ProductName>

<UnitPrice>559.00</UnitPrice>

Page 212: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

<UnitsInStock>12</UnitsInStock>

</Products>

<Products>

<ProductID>132</ProductID>

<ProductName>Product Name</ProductName><UnitPrice>59.00</UnitPrice>

<UnitsInStock>102</UnitsInStock>

</Products>

<Products>

<ProductID>259</ProductID>

<ProductName>Product Name</ProductName>

<UnitPrice>599.00</UnitPrice>

<UnitsInStock>6</UnitsInStock>

</Products>

</Suppliers>

Which of the following SELECT statement would you write?

A. SELECT s.SupplierID, s.CompanyName, s.ContactName, s.Phone, p.ProductID, p.UnitPrice,UnitsInStockFROM Suppliers AS sINNER JOIN Products AS p ON s.SupplierID = p.SupplierID FOR XML AUTO, ELEMENTS

B. SELECT s.SupplierID, s.CompanyName, s.ContactName, s.Phone, p.ProductID, p.UnitPrice,UnitsInStockFROM Suppliers AS sINNER JOIN Products AS p ON s.SupplierID = p.SupplierID FOR XML

C. SELECT Suppliers.SupplierID, Suppliers.CompanyName, Suppliers.ContactName, Suppliers.Phone, Products.ProductID, Products.UnitPrice,Products.UnitsInStock FROM SuppliersINNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID FOR XML AUTO

D. SELECT Suppliers.SupplierID, Suppliers.CompanyName, Suppliers.ContactName, Suppliers.Phone, Products.ProductID, Products.UnitPrice,

Page 213: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Products.UnitsInStock FROM SuppliersINNER JOIN Products ON Suppliers.SupplierID = Products.SupplierID FOR XML AUTO, RAW

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

"Pass Any Exam. Any Time." - www.actualtests.com 39 Microsoft 70-461 Exam

QUESTION 49You work as a SQL Server 2012 database developer at ABC.com. ABC.com has a database named SalesDB with tables named Customer and Orders. TheCustomer and Orders tables were created using the following Transact-SQL code:

CREATE TABLE SalesDB.Customers

(

CustomerID int NOT NULL PRIMARY KEY,

CustomerName nvarchar (250) NOT NULL,

Address1 nvarchar (100) NOT NULL,

Address2 nvarchar (100) NULL,

City nvarchar (50) NOT NULL,

State nvarchar (50) NOT NULL,

Zip varchar (5) NOT NULL,

Phone varchar (10) NOT NULL

)

GO

CREATE TABLE SalesDB.Orders

Page 214: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

(

OrderID int NOT NULL PRIMARY KEY,

CustomerID int NOT NULL,

OrderDate datetime NOT NULL,

ShipDate datetime NOT NULL,

CustomerID int NOT NULL,

SalesRepID int NOT NULL

)

GO

You are developing a stored procedure named OrdersByDate that returns the OrderID,CustomerID, CustomerName and OrderDate. The stored procedure will take a parameter named @date that uses the int datatype. The @date parameter will be used to filter the result set based on the OrderDate column in the Orders table.

How would you create the stored procedure?

A. CREATE PROCEDURE OrdersByDate@date intASSELECT OrderID, CustomerID, CustormerName, OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHEREOrderDate = CONVERT(datetime,@date)

B. CREATE PROCEDURE OrdersByDate@date intASSELECT OrderID, CustomerID, CustormerName, OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHEREOrderDate =@date

C. CREATE PROCEDURE OrdersByDate@date intASSELECT OrderID, CustomerID, CustormerName, OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHEREOrderDate = CAST(@date AS datetime)

D. CREATE PROCEDURE OrdersByDate@date intAS

Page 215: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

SELECT OrderID, CustomerID, CustormerName, OrderDate FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHEREOrderDate = PARSE(@date AS datetime)

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:

QUESTION 50You 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.)

A. CREATE PROCEDURE dbo.GetCustomerRating@CustomerID INT,@CustomerRating INT OUTPUTAS

SET NOCOUNT ONSELECT @CustomerRating = CustomerOrders/CustomerValueFROM CustomersWHERE CustomerID = @CustomerID

RETURNGO

B. EXECUTE dbo.GetCustomerRating 1745

C. DECLARE @CustomerRatingByCustomer INTDECLARE @Result INTEXECUTE @Result = dbo.GetCustomerRating

1745,@CustomerRatingByCustomer

D. CREATE PROCEDURE dbo.GetCustomerRating

Page 216: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

@CustomerID INT,@CustomerRating INT OUTPUTAS

SET NOCOUNT ONSELECT @Result = CustomerOrders/CustomerValueFROM CustomersWHERE CustomerID = @CustomerID

RETURN @ResultGO

E. DECLARE @CustomerRatingByCustomer INTEXECUTE dbo.GetCustomerRating

@CustomerID = 1745,@CustomerRating = @CustomerRatingByCustomer OUTPUT

F. CREATE PROCEDURE dbo.GetCustomerRating@CustomerID INTAS

DECLARE @Result INT

SET NOCOUNT ONSELECT @Result = CustomerOrders/CustomerValueFROM CustomersWHERE CustomerID = @CustomerID

RETURNS @ResultGO

Correct Answer: AESection: (none)Explanation

Explanation/Reference:

QUESTION 51You use Microsoft SQL Server 2012 to develop a database application.

You create a stored procedure named DeleteJobCandidate.

You need to ensure that if DeleteJobCandidate encounters an error, the execution of the stored procedure reports the error number.

Page 217: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Which Transact-SQL statement should you use?

A. DECLARE @ErrorVar INT;DECLARE @RowCountVar INT;

EXEC DeleteJobCandidate

SELECT @ErrorVar = @@ERROR, @RowCountVar = @@ROWCOUNT;IF (@ErrorVar <> 0)PRINT N'Error = ' + CAST(@@ErrorVar AS NVARCHAR(8)) + N', Rows Deleted = ' + CAST(@RowCountVar AS NVARCHAR(8));GO

B. DECLARE @ErrorVar INT;DECLARE @RowCountVar INT;

EXEC DeleteJobCandidate

SELECT @ErrorVar = ERROR_STATE(),@RowCountVar = @@ROWCOUNT;IF (@ErrorVar <> 0)PRINT N'Error = ' + CAST(ERROR_STATE() AS NVARCHAR(8)) + N', Rows Deleted = ' + CAST(@RowCountVar AS NVARCHAR(8));GO

C. EXEC DeleteJobCandidateIF (ERROR_STATE() != 0)PRINT N'Error = ' + CAST(@@ERROR AS NVARCHAR(8)) + N', Rows Deleted = ' + CAST(@@ROWCOUNT AS NVARCHAR(8));GO

D. EXEC DeleteJobCandidatePRINT N'Error = ' + CAST(@@ERROR AS NVARCHAR(8)) + N', Rows Deleted = ' + CAST(@@ROWCOUNT AS NVARCHAR(8));GO

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Explanation:Reference: http://msdn.microsoft.com/en-us/library/ms190193.aspx Reference: http://msdn.microsoft.com/en-us/library/ms188790.aspx

QUESTION 52

Page 218: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You use Microsoft SQL Server 2012 to develop a database application.

Your application sends data to an NVARCHAR(MAX) variable named @var.

You need to write a Transact-SQL statement that will find out the success of a cast to a decimal (36,9).

Which code segment should you use?

http://www.gratisexam.com/

A. BEGIN TRYSELECT

convert (decimal(36,9), @var) as Value,'True' As BadCast

END TRYBEGIN CATCHSELECT

convert (decimal(36,9), @var) as Value,'False' As BadCast

END CATCH

B. TRY(SELECT convert (decimal(36,9), @var)SELECT 'True' As BadCast

)CATCH(

SELECT 'False' As BadCast)

C. SELECTCASEWHEN convert (decimal(36,9), @var) IS NULLTHEN 'True'ELSE 'False'END

AS BadCast

D. SELECTIF(TRY_PARSE(@var AS decimal(36,9)) IS NULL,

Page 219: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

'True','False')

AS BadCast

Correct Answer: DSection: (none)Explanation

Explanation/Reference:Explanation:Reference: http://msdn.microsoft.com/en-us/library/hh213126.aspx

Page 220: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

training_kit

QUESTION 1 What is the restriction that grouped queries impose on your expressions?

A. If the query is a grouped query, you must invoke an aggregate function.

B. If the query has an aggregate function, it must have a GROUP BY clause.

C. The elements in the GROUP BY clause must also be specified in the SELECT clause.

D. If you refer to an element from the queried tables in the HAVING, SELECT, or ORDER BY clauses, it must either appear in the GROUP BY list or be contained by an aggregate function

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 2 What is the purpose of the GROUPING and GROUPING_ID functions? (Choose all that apply.)

http://www.gratisexam.com/

A. You can use these functions in the GROUP BY clause to group data.

B. You can use these functions to tell whether a NULL in the result represents a placeholder for an element that is not part of the grouping set or an original NULLfrom the table.

C. You can use these functions to uniquely identify the grouping set that the result row is associated with.

D. These functions can be used to sort data based on grouping set association that is, first detail, and then aggregates.

Correct Answer: BCDSection: (none)Explanation

Explanation/Reference:

Page 221: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 3What is the difference between the COUNT(*) aggregate function and the COUNT(<expression>) general set function?

A. COUNT(*) counts rows; COUNT(<expression>) counts rows where <expression> is not NULL.

B. COUNT(*) counts columns; COUNT(<expression>) counts rows.

C. COUNT(*) returns a BIGINT; COUNT(<expression>) returns an INT.

D. There’s no difference between the functions.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 4 How does the PIVOT operator determine what the grouping element is?

A. It’s the element specified as input to the GROUPING function.

B. It’s determined by elimination—the element(s) from the queried table that were not specified as the spreading or aggregation elements.

C. It’s the element specified in the GROUP BY clause.

D. It’s the primary key.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 5 Which of the following are not allowed in the PIVOT operator’s specification? (Chooseall that apply.)

Page 222: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Specifying a computation as input to the aggregate function

B. Specifying a computation as the spreading element

C. Specifying a subquery in the IN clause

D. Specifying multiple aggregate functions

Correct Answer: ABCDSection: (none)Explanation

Explanation/Reference:A. Correct: You cannot specify a computation as input to the aggregate function,rather just a name of a column from the input table.B. Correct: You cannot specify a computation as the spreading element, rather just aname of a column from the input table.C. Correct: You cannot specify a subquery in the IN clause, rather just a static list.D. Correct: You cannot specify multiple aggregate functions, rather just one.

QUESTION 6What is the data type of the target values column in the result of an UNPIVOT operator?

A. INT

B. NVARCHAR(128)

C. SQL_VARIANT

D. The data type of the source columns that you unpivot

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 7What is the default frame window functions use when a window order clause is specified but an explicit window frame clause isn’t? (Choose all that apply.)

A. ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW

B. ROWS UNBOUNDED PRECEDING

Page 223: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW

D. RANGE UNBOUNDED PRECEDING

Correct Answer: CDSection: (none)Explanation

Explanation/Reference:C. Default frameD.This is an abbreviated form of the default frame, having the same meaning.

QUESTION 8What do the RANK and DENSE_RANK functions compute?

A. The RANK function returns the number of rows that have a lower ordering value (assuming ascending ordering) than the current; the DENSE_RANK functionreturns the number of distinct ordering values that are lower than the current.

B. The RANK function returns one more than the number of rows that have a lower ordering value than the current; the DENSE_RANK function returns one morethan the number of distinct ordering values that are lower than the current.

C. The RANK function returns one less than the number of rows that have a lower ordering value than the current; the DENSE_RANK function returns one less thanthe number of distinct ordering values that are lower than the current.

D. The two functions return the same result unless the ordering is unique.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 9Why are window functions allowed only in the SELECT and ORDER BY clauses of a query?

A. Because they are supposed to operate on the underlying query’s result, which is achieved when logical query processing gets to the SELECT phase.

B. Because Microsoft didn’t have time to implement them in other clauses.

C. Because you never need to filter or group data based on the result of window functions.

D. Because in the other clauses, the functions are considered door functions (also known as backdoor functions).

Page 224: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 10Which full-text search elements can you use to prevent indexing noisy words? (Choose all that apply.)

A. Stopwords

B. Thesaurus

C. Stemmer

D. Stoplists

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:Stopwords include noisy words.You group stopwords in stoplists.

QUESTION 11Which database do you have to install in order to enable the Semantic Search feature?

http://www.gratisexam.com/

A. msdb

B. distribution

C. semanticsdb

D. tempdb

Correct Answer: C

Page 225: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:

QUESTION 12 How can you create synonyms for the words searched?

A. You can edit the thesaurus file.

B. You can create a thesaurus table.

C. You can use the stopwords for synonyms as well.

D. Full-text search does not support synonyms.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:Full-text search uses thesaurus files and not tables for synonyms.

QUESTION 13Which of the following is not a part of the CONTAINS predicate?

A. FORMSOF

B. THESAURUS

C. NEAR

D. PROPERTY

E. TEMPORARY

Correct Answer: ESection: (none)Explanation

Explanation/Reference:- Word A single word without spaces or other punctuation. Double quotation marks are not necessary. …WHERE CONTAINS ('computer')Phrase Multiple words or included spaces.

Page 226: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

…WHERE CONTAINS('"computer software"')Or, to use a double quote mark:… WHERE CONTAINS('"computer ""science"" "')

- Wildcard Words or phrases with the asterisk (*) added to the end. For more information, see Using Wildcards in the CONTAINS Predicate. …WHERE CONTAINS('"compu*"')

Matches "computer", "computers","computation", and "compulsory"

- Boolean Words, phrases, and wildcard strings combined by using the Boolean operators AND, OR, or NOT. Enclose the Boolean terms in double quotationmarks. …WHERE CONTAINS('"computer monitor" AND "software program" AND "install component"')

… WHERE CONTAINS (' "computer" AND "software" AND "install" ' )

…WHERE CONTAINS('"computer software install"')

- Near Words, phrases, or wildcards separated by the function NEAR. For more information, see NEAR Term. …WHERE CONTAINS('"computer" NEAR "software"')FormsOf Matches a word and the inflectional versions of that word. For more information, see FORMSOF Term. …WHERE CONTAINS('FORMSOF (INFLECTIONAL, "happy"))

Matches "happy", "happier","happiest", "happily", and so on.

- IsAbout Combines matching results over multiple word, phrase, or wildcard search terms. Each search term can optionally be weighted. You can optionallyspecify the rank calculation method, which combines the weights and how many of the items the document matches. For more information, see ISABOUT Term. …WHERE CONTAINS('ISABOUT ( "computer" WEIGHT (0.5) ,

Page 227: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

"software" WEIGHT (2.0) , "development" WEIGHT (10.0) ) RANKMETHOD INNER PRODUCT')

QUESTION 14 Which form of the proximity term defines the distance and the order?

A. NEAR((SearchWord1, SearchWord2), 5, TRUE)

B. NEAR((SearchWord1, SearchWord2), CLOSE, ORDER)

C. NEAR((SearchWord1, SearchWord2), 5)

D. NEAR(SearchWord1, SearchWord2)

Correct Answer: ASection: (none)Explanation

Explanation/Reference:you want to find documents where “dog” and “cat” appear within 4 words of each other, and where "dog" appears before "cat":

'NEAR((dog, cat), 4, TRUE)'

QUESTION 15 What can you search for with the CONTAINS predicate? (Choose all that apply.)

A. Inflectional forms of a word

B. Synonyms of a searched word

C. Translations of a word

D. Text in which a search word is close to another search word

E. A prefix of a word or a phrase only

Correct Answer: ABDESection: (none)Explanation

Explanation/Reference:

Page 228: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 16Which function can be used to rank documents based on proximity of words?

A. CONTAINSTABLE()

B. FREETEXTTABLE()

C. SEMANTICKEYPHRASETABLE()

D. SEMANTICSIMILARITYTABLE()

E. SEMANTICSIMILARITYDETAILSTABLE()

Correct Answer: ASection: (none)Explanation

Explanation/Reference:A. Correct: You use the CONTAINSTABLE function to rank documents based on proximityof words.B. Incorrect: You use the FREETEXTTABLE function to rank documents based oncontainment of words.C. Incorrect: You use the SEMANTICKEYPHRASETABLE function to return key phrasesassociated with the full-text indexed column.D. Incorrect: You use the SEMANTICSIMILARITYTABLE function to retrieve documentsscored by similarity to a specified document.E. Incorrect: You use the SEMANTICSIMILARITYDETAILSTABLE function to return keyphrases that are common across two documents.

QUESTION 17Which function can be used to find the document that is most semantically similar to a specified document?

A. CONTAINSTABLE()

B. FREETEXTTABLE()

C. SEMANTICKEYPHRASETABLE()

D. SEMANTICSIMILARITYTABLE()

E. SEMANTICSIMILARITYDETAILSTABLE()

Correct Answer: D

Page 229: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Section: (none)Explanation

Explanation/Reference:A. Correct: You use the CONTAINSTABLE function to rank documents based on proximity of words.

QUESTION 18Which function returns a table with key phrases associated with the full-text indexed column?

A. CONTAINSTABLE()

B. FREETEXTTABLE()

C. SEMANTICKEYPHRASETABLE()

D. SEMANTICSIMILARITYTABLE()

E. SEMANTICSIMILARITYDETAILSTABLE()

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 19 Which FOR XML options are valid? (Choose all that apply.)

A. FOR XML AUTO

B. FOR XML MANUAL

C. FOR XML DOCUMENT

D. FOR XML PATH

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:

Page 230: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 20Which directive of the FOR XML clause should you use to produce element-centric XML?

A. ATTRIBUTES

B. ROOT

C. ELEMENTS

D. XMLSCHEMA

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 21Which FOR XML options can you use to manually format the XML returned? (Choose all that apply.)

A. FOR XML AUTO

B. FOR XML EXPLICIT

C. FOR XML RAW

D. FOR XML PATH

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:A. Incorrect: FOR XML AUTO automatically formats the XML retuned.B. Correct: FOR XML EXPLICIT allows you to manually format the XML returned.C. Incorrect: FOR XML RAW automatically formats the XML retuned.D. Correct: FOR XML PATH allows you to manually format the XML returned.

QUESTION 22Which of the following is not a FLWOR clause?

A. for

Page 231: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

B. let

C. where

D. over

E. return

Correct Answer: DSection: (none)Explanation

Explanation/Reference:FLWOR (pronounced "flower") is an acronym for "For, Let, Where, Order by, Return".

QUESTION 23Which node type test can be used to retrieve all nodes of an XML instance?

http://www.gratisexam.com/

A. Asterisk (*)

B. comment()

C. node()

D. text()

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 24Which conditional expression is supported in XQuery?

Page 232: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. IIF

B. if..then..else

C. CASE

D. switch

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 25 Which of the following is not an XML data type method?

A. merge()

B. nodes()

C. exist()

D. value()

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 26What kind of XML indexes can you create? (Choose all that apply.)

A. PRIMARY

B. PATH

C. ATTRIBUTE

D. PRINCIPALNODES

Page 233: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: ABSection: (none)Explanation

Explanation/Reference:

QUESTION 27Which XML data type method do you use to shred XML data to tabular format?

A. modify()

B. nodes()

C. exist()

D. value()

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 28Which of the following are T-SQL regular identifiers? (Choose all that apply.)

A. categoryname

B. category name

C. category$name

D. category_name

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:

Page 234: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 29Which data type should be used in place of TIMESTAMP?

A. VARBINARY

B. ROWVERSION

C. DATETIME2

D. TIME

Correct Answer: BSection: (none)Explanation

Explanation/Reference:ROWVERSION is the replacement for the deprecated TIMESTAMP.

QUESTION 30 How can you express that the column categoryname allow NULLs?

A. categoryname PERMIT NULL NVARCHAR(15)

B. categoryname NVARCHAR(15) ALLOW NULL

C. categoryname NVARCHAR(15) PERMIT NULL

D. categoryname NVARCHAR(15) NULL

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 31Which of the following columns would be appropriate as a surrogate key? (Choose all that apply.)

A. The time (in hundredths of a second) that the row was inserted

B. An automatically increasing integer number

C. The last four digits of a social security number concatenated with the first eight digits of a user's last name

Page 235: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D. A uniqueidentifier (GUID) newly selected from SQL Server at the time the row is inserted

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:

QUESTION 32 You want to enforce that a valid supplierid be entered for each productid in the Production.Products table. What is the appropriate constraint to use?

A. A unique constraint

B. A default constraint

C. A foreign key constraint

D. A primary key constraint

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 33What metadata tables give you a list of constraints in a database? (Choose all that apply.)

A. sys.key_constraints

B. sys.indexes

C. sys.default_constraints

D. sys.foreign_keys

Correct Answer: ACDSection: (none)Explanation

Explanation/Reference:A. Correct: sys.key_constraints lists all primary key and unique constraints in a database.

Page 236: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

B. Incorrect: sys.indexes does not list constraints.C. Correct: sys.default_constraints lists the default constraints in a database.D. Correct: sys.foreign_keys lists all the foreign keys in a database.

QUESTION 34Which of the following operators work in T-SQL views? (Choose all that apply.)

A. The WHERE clause

B. The ORDER BY clause

C. The UNION or UNION ALL operators

D. The GROUP BY clause

Correct Answer: ACDSection: (none)Explanation

Explanation/Reference:

QUESTION 35What is the result of WITH SCHEMABINDING in a view?

A. The view cannot be altered without altering the table.

B. The tables referred to in the view cannot be altered unless the view is first altered.

C. The tables referred to in the view cannot be altered unless the view is first dropped.

D. The view cannot be altered unless the tables it refers to are first dropped.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 36 What is the result of the WITH CHECK OPTION in a view that has a WHERE clause in its SELECT statement?

Page 237: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. Data can no longer be updated through the view.

B. Data can be updated through the view, but primary key values cannot be changed.

C. Data can be updated through the view, but values cannot be changed that would cause rows to fall outside the filter of the WHERE clause.

D. Data can be updated through the view, but only columns with check constraints can be changed.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 37What types of database objects can have synonyms? (Choose all that apply.)

http://www.gratisexam.com/

A. Stored procedures

B. Indexes

C. Temporary tables

D. Database users

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

QUESTION 38Which of the following are true about synonyms? (Choose all that apply.)

A. Synonyms do not store T-SQL code or data.

Page 238: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

B. Synonyms do not require schema names.

C. Synonym names can match those of the objects they refer to.

D. Synonyms can reference objects in other databases or through linked servers.

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:

QUESTION 39 What kind of dependencies do synonyms have on the objects they refer to?

A. Synonyms can be created WITH SCHEMABINDING to prevent the underlying objects from being altered.

B. Synonyms can refer to other synonyms.

C. Synonyms can be created to refer to database objects that do not yet exist.

D. Synonyms can be created without an initial schema name, which can be added later.

Correct Answer: CSection: (none)Explanation

Explanation/Reference: Synonyms can be created to refer to database objects that do not yet exist. but they can't be referenced unless existing

QUESTION 40 In which case out of the following are you normally not allowed to specify the target column in an INSERT statement?

A. If the column has a default constraint associated with it

B. If the column allows NULLs

C. If the column does not allow NULLs

D. If the column has an IDENTITY property

Correct Answer: DSection: (none)Explanation

Page 239: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 41What are the things that the SELECT INTO statement doesn’t copy from the source? (Choose all that apply.)

A. Indexes

B. Constraints

C. The IDENTITY property

D. Triggers

Correct Answer: ABDSection: (none)Explanation

Explanation/Reference:

QUESTION 42What are the benefits of using the combination of statements CREATE TABLE and INSERT SELECT over SELECT INTO? (Choose all that apply.)

A. Using the CREATE TABLE statement, you can control all aspects of the target table. Using SELECT INTO, you can’t control some of the aspects, like thedestination file group.

B. The INSERT SELECT statement is faster than SELECT INTO.

C. The SELECT INTO statement locks both data and metadata for the duration of the transaction. This means that until the transaction finishes, you can run intoblocking related to both data and metadata. If you run the CREATE TABLE and INSERT SELECT statements in separate transactions, locks against metadata will be released quickly, reducing the probability for and duration of blocking related to metadata.

D. Using the CREATE TABLE plus INSERT SELECT statements involves less coding than using SELECT INTO.

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

Page 240: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 43How do you modify a column value in a target row and collect the result of the modification in one visit to the row?

A. By using an UPDATE based on a join

B. By using an UPDATE based on a table expression

C. By using an UPDATE with a variable

D. The task cannot be achieved with only one visit to the row.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 44What are the benefits of using an UPDATE statement based on joins? (Choose all that apply.)

A. You can filter the rows to update based on information in related rows in other tables.

B. You can update multiple tables in one statement.

C. You can collect information from related rows in other tables to be used in the source expressions in the SET clause.

D. You can use data from multiple source rows that match one target row to update the data in the target row.

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

QUESTION 45How can you update a table, setting a column to the result of a window function?

A. By using an UPDATE based on a join

Page 241: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

B. By using an UPDATE based on a table expression

C. By using an UPDATE with a variable

D. The task cannot be achieved.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:With an UPDATE based on table expressions, you can invoke a windowfunction in the inner query’s SELECT list. You can then refer to the alias you assignedto the result column in the outer UPDATE statement’s SET clause.

QUESTION 46 How do you delete rows from a table for which a ROW_NUMBER computation is equal to 1?

A. You refer to the ROW_NUMBER function in the DELETE statement’s WHERE clause.

B. You use a table expression like a CTE or derived table computing a column based on the ROW_NUMBER function, and then issue a filtered DELETE statementagainst the table expression.

C. You use a table expression like a CTE or derived table computing a column based on the ROW_NUMBER function, and then issue a filtered TRUNCATEstatement against the table expression.

D. The task cannot be achieved.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 47Which of the following is applicable to a DELETE statement? (Choose all that apply.)

A. The statement writes more to the transaction log than TRUNCATE.

B. The statement resets an IDENTITY property.

C. The statement is disallowed when a foreign key points to the target table.

Page 242: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

D. The statement is disallowed when an indexed view based on the target table exists.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 48Which of the following is applicable to a TRUNCATE statement? (Choose all that apply.)

A. The statement writes more to the transaction log than DELETE.

B. The statement resets an IDENTITY property.

C. The statement is disallowed when a foreign key points to the target table.

D. The statement is disallowed when an indexed view based on the target table exists.

Correct Answer: BCDSection: (none)Explanation

Explanation/Reference:

QUESTION 49Which function do you use to return the last identity value generated in a specific table?

A. MAX

B. SCOPE_IDENTITY

C. @@IDENTITY

D. IDENT_CURRENT

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 243: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 50What are the advantages of using a sequence object instead of IDENTITY? (Choose all that apply.)

A. The IDENTITY property doesn’t guarantee that there won’t be gaps and the sequence object does.

B. The IDENTITY property cannot be added to or removed from an existing column; a DEFAULT constraint with a NEXT VALUE FOR function can be added to orremoved from an existing column.

C. A new identity value cannot be generated before issuing an INSERT statement, whereas a sequence value can.

D. You cannot provide your own value when inserting a row into a table with an IDENTITY column without special permissions. You can specify your own value for acolumn that normally gets its values from a sequence object.

Correct Answer: BCDSection: (none)Explanation

Explanation/Reference:

QUESTION 51In an INSERT SELECT statement, how do you generate sequence values in specific order?

A. Use the OVER clause in the NEXT VALUE FOR function.

B. Specify an ORDER BY clause at the end of the query.

C. Use TOP (100) PERCENT and ORDER BY in the query.

D. Use TOP (9223372036854775807) and ORDER BY in the query.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 52Which WHEN clauses are required in a MERGE statement at minimum?

Page 244: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. At minimum, the WHEN MATCHED and WHEN NOT MATCHED clauses are required.

B. At minimum, only one clause is required, and it can be any of the WHEN clauses.

C. At minimum, the WHEN MATCHED clause is required.

D. At minimum, the WHEN NOT MATCHED clause is required.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 53What can you specify as the source data in the USING clause? (Choose all that apply.)

http://www.gratisexam.com/

A. A regular table, table variable, or temporary table

B. A table expression like a derived table or a CTE

C. A stored procedure

D. A table function like OPENROWSET or OPENXML

Correct Answer: ABDSection: (none)Explanation

Explanation/Reference:

QUESTION 54Which clause of the MERGE statement isn’t standard?

A. The WHEN MATCHED clause

Page 245: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

B. The WHEN NOT MATCHED clause

C. The WHEN NOT MATCHED BY SOURCE clause

D. All MERGE clauses are standard.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 55When referring in the OUTPUT clause to columns from the inserted rows, when should you prefix the columns with the keyword inserted?

A. Always

B. Never

C. Only when the statement is UPDATE

D. Only when the statement is MERGE

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 56What is the restriction in regard to the table specified as the target of an OUTPUT INTO clause? (Choose all that apply.)

A. The table can only be a table variable.

B. The table can only be a temporary table.

C. The table cannot participate in either side of a foreign key relationship.

D. The table cannot have triggers defined on it.

Correct Answer: CDSection: (none)

Page 246: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 57Which of the following is only possible when using the MERGE statement in regard to the OUTPUT clause?

A. Referring to columns from the source table

B. Referring to both the keywords deleted and inserted

C. Assigning aliases to output columns

D. Using composable DML

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 58Which of the following T-SQL statements automatically occur in the context of a transaction? (Choose all that apply.)

A. An ALTER TABLE command

B. A PRINT command

C. An UPDATE command

D. A SET command

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

QUESTION 59How do the COMMIT and ROLLBACK commands work with nested transactions in T-SQL? (Choose all that apply.)

Page 247: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. A single COMMIT commits the entire nested transaction.

B. A single ROLLBACK rolls back the entire nested transaction.

C. A single COMMIT commits only one level of the nested transaction.

D. A single ROLLBACK rolls back only one level of the nested transaction.

Correct Answer: BCSection: (none)Explanation

Explanation/Reference:single COMMIT commits only the innermost level of a nestedtransaction.

QUESTION 60Which of the following strategies can help reduce blocking and deadlocking by reducing shared locks? (Choose all that apply.)

A. Add the READUNCOMMITTED table hint to queries.

B. Use the READ COMMTTED SNAPSHOT option.

C. Use the REPEATABLE READ isolation level.

D. Use the SNAPSHOT isolation level.

Correct Answer: ABDSection: (none)Explanation

Explanation/Reference:

QUESTION 61What is the advantage of using THROW in a CATCH block?

A. THROW in a CATCH block does not require parameters and so is easier to write.

B. THROW re-throws the original error so that the original error can be handled.

Page 248: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. THROW causes an error severity of level 16 automatically.

D. The statement before a THROW requires a semicolon.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:A. Incorrect: Although it is true that THROW does not take parameters in a CATCHblock, that is not necessarily an advantage.B. Correct: The THROW statement in a CATCH block can re-throw an error and thereby allow you to report on an error in the TRY block without having to havestored any prior information. This makes it possible to do all error handling in theCATCH block.

QUESTION 62 Which of the following functions can be used in a CATCH block to return information about the error? (Choose all that apply.)

A. @@ERROR

B. ERROR_NUMBER()

C. ERROR_MESSAGE()

D. XACT_STATE()

Correct Answer: ABCDSection: (none)Explanation

Explanation/Reference:XACT_STATE() : indicates whether the request has an active user transaction, and whether the transaction is capable of being committed.

1 The current request has an active user transaction. The request can perform any actions, including writing data and committing the transaction.0 There is no active user transaction for the current request.-1 The current request has an active user transaction, but an error has occurred that has caused the transaction to be classified as an uncommittable transaction.The request cannot commit the transaction or roll back to a savepoint; it can only request a full rollback of the transaction. The request cannot perform any writeoperations until it rolls back the transaction. The request can only perform read operations until it rolls back the transaction. After the transaction has been rolledback, the request can perform both read and write operations and can begin a new transaction.

Page 249: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 63How does SET XACT_ABORT ON affect a transaction?

A. If a T-SQL error with a severity level > 16 occurs, the transaction will be aborted.

B. If a T-SQL error with a severity level > 10 occurs, the transaction will be aborted.

C. If a T-SQL error with a severity level > 16 occurs, some statements of the transaction may still be executed.

D. If a T-SQL error with a severity level > 10 occurs, some statements of the transaction may still be executed.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

severity level :Severity level 0-10: These are just information message not actual error.

Severity level 11 to 16: These are errors caused due to user mistakes. We have tried to divide value by 0 in previous article and hence we got severity error 16.

Severity Level 17: This severity indicates that an operation making SQL Server out of resources or exceeding defined limit. That may be disk space or lock limit.

Severity Level 18: This error represents nonfatal internal software error.

Severity Level 19: This error represents some non-configurable internal limit has been exceeded and the current batch process is terminated. To be very frank, Ihave not seen this severity practically in my life.

Severity Level 20: This severity indicates current statement has encountered a problem and because of this severity level client connection with SQL Server will bedisconnected.

Severity Level 21: This severity indicates that you have encountered a problem that affects all processes in the current database.

Severity Level 22: This error indicates problem with database table or index. It may be corrupt or damaged.

Severity Level 23: This error indicates problem with database integrity which may be fixed by DBCC command.

Severity Level 24: This error indicates problem with the hardware of SQL Server. Need to check disk drive and related hardware extensively.

Page 250: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 64Which of the following techniques can be used to inject unwanted code into dynamic SQL when user input is concatenated with valid SQL commands?

A. Insert a comment string of two dashes, then the malicious code, and then a single quotation mark.

B. Insert a single quotation mark, then the malicious code, and then a comment string of two dashes.

C. Insert the malicious code followed by a single quotation mark and a comment string of two dashes.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:The initial single quotation mark terminates the input string, and the final comment removes the effect of the terminating single quotation mark. Then the malicious code can be inserted in between them.

QUESTION 65 What are the advantages of sp_executesql over the EXECUTE() command? (Choose all that apply.)

A. sp_executesql can parameterize search arguments and help prevent SQL injection.

B. sp_executesql uses Unicode strings.

C. sp_executesql can return data through output parameters.

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:- Parameterization is the key advantage of sp_executesql over the EXEC() statement because it ensures that any injected code will only be seen as a stringparameter value, and not as executable code.- The use of output parameters solves a serious limitation of the EXECUTE command. EXECUTE cannot return information to the calling session directly.

QUESTION 66Which of the following are true about the SET QUOTED_IDENTIFIER statement? (Choose all that apply.)

Page 251: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. When set to ON, QUOTED_IDENTIFIER allows you to use double quotation marks to delimit T-SQL identifiers such as table and column names.

B. When set to OFF, QUOTED_IDENTIFIER allows you to use double quotation marks to delimit T-SQL identifiers such as table and column names.

C. When set to ON, QUOTED_IDENTIFIER allows you to use double quotation marks to delimit strings.

D. When set to OFF, QUOTED_IDENTIFIER allows you to use double quotation marks to delimit strings.

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:

QUESTION 67Which of the following T-SQL statements can be used to cause branching within a stored procedure? (Choose all that apply.)

A. WHILE

B. BEGIN/END

C. IF/ELSE

D. GO

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

QUESTION 68A stored procedure calls another stored procedure. The calling stored procedure has created temporary tables, declared variables, and passes parameters to thecalled stored procedure. What data can the called stored procedure see from the caller?

A. The called procedure can see the variables, temporary tables, and passed parameters of the caller.

B. The called procedure can see the temporary tables but not the variables and passed parameters of the caller.

C. The called procedure can see the passed parameters and temporary tables but not the variables of the caller.

D. The called procedure cannot see any objects created by the calling procedure.

Page 252: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: CSection: (none)Explanation

Explanation/Reference:Both passed parameters and temporary tables are visible to called storedprocedures.

QUESTION 69 How can you use output parameters in T-SQL stored procedures? (Choose all that apply.)

A. You can pass data into a procedure by using an output parameter, but you cannot receive information back from it.

B. You can pass data into a procedure by using an output parameter, and any change made to the parameter will be passed back to the calling routine.

C. You cannot pass data into a procedure by using an output parameter; it is only used for passing data back to the caller.

D. You cannot pass data into a procedure by using an output parameter, nor can you receive data back from a procedure from an output parameter.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 70How do the inserted and deleted tables work with a DML statement in an AFTER trigger?

A. For a DELETE statement, the inserted table contains new rows and the deleted table contains the deleted rows.

B. The inserted table only contains rows from the INSERT statement, and the deleted table contains only rows from the DELETE statement.

C. For an INSERT statement, the inserted table contains new rows and the deleted table is empty.

D. For an UPDATE statement, the inserted table is empty and the deleted table contains all the changed rows.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

Page 253: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 71Which of the following statements are true about an INSTEAD OF trigger? (Choose all that apply.)

http://www.gratisexam.com/

A. INSTEAD OF triggers can be created on views.

B. INSTEAD OF triggers execute instead of AFTER triggers.

C. INSTEAD OF triggers can only be declared for UPDATE statements.

D. INSTEAD OF triggers execute code in place of the original DML statement

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:

QUESTION 72How can you turn off nested triggers on a SQL Server instance by using T-SQL?

A. Use the sp_configure stored procedure followed by 'nested triggers' and 'OFF'.

B. Use the sp_configure stored procedure followed by 'nested triggers' and 0.

C. Use the sp_configure stored procedure followed by 'nested triggers' and 'OFF',followed by the RECONFIGURE statement.

D. Use the sp_configure stored procedure followed by 'nested triggers' and 0,followed by the RECONFIGURE statement.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

Page 254: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 73Which of the following is true about scalar UDFs?

A. Scalar UDFs are both inline and multistatement.

B. Scalar UDFs return the result of a SELECT statement.

C. Scalar UDFs can be invoked in a SELECT list or a WHERE clause.

D. Scalar UDFs can be invoked in the FROM clause of a SELECT statement.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:The results of a SELECT statement would be a table, and scalar UDFs do not return tables.You can invoke a scalar UDF in a SELECT list or in the conditions of a WHERE clause, anywhere a scalar value would be valid.

QUESTION 74 Which of the following are true about table-valued UDFs?

A. Table-valued UDFs can return scalar values or tables.

B. Table-valued UDFs always involve multiple T-SQL statements.

C. Table-valued UDFs can be invoked in a SELECT list or a WHERE clause.

D. Table-valued UDFs can be invoked in the FROM clause of a SELECT statement.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:The FROM clause requires a table and table-valued UDFs return tables.

QUESTION 75Which sentence best describes the difference between an inline table-valued UDF and a multistatement table-valued UDF?

Page 255: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. An inline table-valued UDF defines the schema of a table variable, with column names and data types, and inserts data into the table variable.

B. An inline table-valued UDF defines the schema of a permanent table, with column names and data types, and then inserts data into that table.

C. A multistatement table-valued UDF defines the schema of a table variable, with column names and data types, and inserts data into the table variable.

D. A multistatement table-valued UDF defines the schema of a permanent table, with column names and data types, and then inserts data into that table.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:An inline table-valued UDF does not define the schema of the table structure it returns.

QUESTION 76What are the actions of the optimization phase of query execution? (Choose all that apply.)

A. Generation of the algebrized tree

B. Generation of candidate plans

C. Selection of the best candidate plan

D. Caching the plan

E. Query execution

Correct Answer: BCSection: (none)Explanation

Explanation/Reference:

QUESTION 77In which phase of query execution does SQL Server check whether the objects referred to by the query exist?

A. In the parsing phase

B. In the binding phase

C. In the optimization phase

D. In the execution phase

Page 256: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 78Which of the following is not a part of an Extended Events package?

A. Predicates

B. Targets

C. Sources

D. Actions

Correct Answer: CSection: (none)Explanation

Explanation/Reference:A package can contain any or all of the following objects :- Events- Targets- Actions- Types- Predicates- Maps

QUESTION 79Which SET session options are useful for query optimization? (Choose all that apply.)

A. SET STATISTICS IO

B. SET STATISTICS EXECUTION_DETAILS

C. SET IDENTITY_INSERT

D. SET STATISTICS TIME

Page 257: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: ADSection: (none)Explanation

Explanation/Reference:

QUESTION 80How do you read a graphical execution plan?

A. From top to bottom, from left to right

B. From top to bottom, from right to left

C. From left to right, from top to bottom

D. From right to left, from top to bottom

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 81Which commands turn on an XML plan? (Choose all that apply.)

A. SET EXECUTION_XML ON

B. SET SHOWPLAN_XML ON

C. SET XML PLAN ON

D. SET STATISTICS XML ON

Correct Answer: BDSection: (none)Explanation

Explanation/Reference:You use the SET SHOWPLAN_XML command to turn on the estimated XML plans.

Page 258: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

You use the SET STATISTICS XML command to turn on the actual XML plans.

QUESTION 82Which DMO gives you information about index usage?

A. sys.dm_exec_query_stats

B. sys.dm_exec_query_text

C. sys.dm_db_index_usage_stats

D. sys.indexes

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 83What is the most important drawback of DMOs?

A. You must have enough data collected from the last restart of SQL Server.

B. DMOs are complex to use.

C. DMOs are not available in the Standard edition of SQL Server.

D. You have to recreate DMOs before each analysis.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 84How can you find the text of the query executed by using DMOs?

Page 259: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

A. This info is provided in the sys.dm_exec_query_stats dynamic management view.

B. By querying the sys.dm_exec_sql_text dynamic management function.

C. The sys.dm_exec_query_plan dynamic management function returns the query text.

D. You cannot find the query text through DMOs

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

QUESTION 85What levels can an index have? (Choose all that apply.)

A. Intermediate level

B. Heap level

C. Root level

D. Leaf level

Correct Answer: ACDSection: (none)Explanation

Explanation/Reference:

QUESTION 86How many clustered indexes can you create on a table?

A. 999

B. 16

C. 1

D. 900

Page 260: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 87What is the row locator when a table is stored as a balanced tree?

A. RID.

B. Columnstore index key.

C. Clustering key.

D. A table is never stored as a balanced tree.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 88 How can you support the SELECT clause of a query by using a nonclustered index that is already used for the WHERE clause?

A. You could use SELECT *.

B. You could modify the index that is already used to include the columns from the select list that are not part of the key.

C. You could add column aliases.

D. There is no way to support the SELECT clause with indexes.

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

Page 261: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

QUESTION 89Where does SQL Server sort the data, if a sort is needed?

A. In the current database

B. In the master database

C. In the msdb database

D. SQL Server sorts data in memory, or spills the data to tempdb if it does not fit in memory

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 90You create an index to support the WHERE clause of a query. However, SQL Server does not use the index. What are the possible reasons? (Choose all thatapply.)

A. The arguments in the predicate are not searchable.

B. SQL Server does not consider using an index to support the WHERE clause.

C. The predicate is not selective enough.

D. You are in the context of the tempdb database, and SQL Server does not use indexes in this database.

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:

QUESTION 91How can SQL Server estimate the cardinality of a query?

A. SQL Server stores the cardinality information on leaf-level pages of indexes.

B. SQL Server quickly executes the query on 10 percent of sample data.

Page 262: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. SQL Server cannot estimate the cardinality of a query if you do not provide a table hint.

D. SQL Server uses statistics to estimate the cardinality of a query.

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 92Which of the following is not a reason to update statistics manually?

A. You just rebuilt an index.

B. You bulk-inserted a large amount of data to a table and want to query this table immediately after the insert.

C. You upgraded the database.

D. Query execution times are slow; however, you know that the queries are written correctly and supported with appropriate indexes.

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

QUESTION 93What is the limit for the number of steps in statistic histograms?

A. 10 steps per histogram

B. 200 histograms per column

C. 200 pages per histogram

D. 200 steps per histogram

Correct Answer: DSection: (none)Explanation

Page 263: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 94 When you fetch rows from a cursor, how do you know when there are no more rows to fetch?

A. When the @@FETCH_STATUS function returns 0

B. When the @@FETCH_STATUS function returns -1

C. When the @@FETCH_STATUS function returns -2

D. When the @@FETCH_STATUS function generates an error

Correct Answer: BSection: (none)Explanation

Explanation/Reference:

A. Incorrect: 0 means that the last fetch was successful. There could be more rows.B. Correct: -1 means that the row is beyond the result set.C. Incorrect: -2 means that the row fetched is missing. There still could be more rows.D. Incorrect: The function shouldn’t generate any errors.

QUESTION 95Why is it important to prefer set-based solutions for querying tasks instead of iterative ones? (Choose all that apply.)

A. Because set-based solutions are based on the relational model, which is the foundation of T-SQL

B. Because set-based solutions always provide better performance than iterative solutions

C. Because set-based solutions usually involve less code than iterative solutions

D. Because set-based solutions enable you to rely on the order of data

Correct Answer: ACSection: (none)Explanation

Explanation/Reference:A. Correct: Set-based solutions are based on principles from the relational model,and this model is the foundation of SQL (the standard language) and T-SQL (the

Page 264: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

dialect in SQL Server).B. Incorrect: Although it is not common, sometimes iterative solutions are fasterthan set-based ones.C. Correct: Because set-based solutions are declarative and iterative solutions areimperative, set-based solutions tend to involve less code.D. Incorrect: Set-based solutions cannot make any assumptions regarding the orderof the data because sets are unordered.

QUESTION 96When you need to operate on one row at a time, what are the alternatives to using a cursor?

A. Using the FOR EACH looping construct.

B. Retrieving the minimum and maximum keys, and then looping with a counter that starts with the minimum and keeps being incremented by 1 in each iterationuntil it reaches the maximum.

C. Using a TOP (1) query ordered by the key to fetch the first row. Then use a loop while the last key returned is not NULL. In each iteration of the loop, process the current row and then use a TOP (1) query where the key is greater than the last,ordered by the key, to fetch the nextrow.

D. Define a per-row SELECT trigger.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 97Which of the following cases is suitable for using table variables? (Choose all that apply.)

A. When the tables are very small and the plan is trivial

B. When the tables are very small and the plan is nontrivial

C. When the tables are large and the plan is trivial

D. When the tables are large and the plan is nontrivial

Correct Answer: ABCSection: (none)Explanation

Page 265: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 98Can you have indexes on table variables?

A. No

B. Yes, by running the CREATE INDEX command

C. Yes, indirectly by defining primary key and unique constraints

D. Yes, by defining foreign keys

Correct Answer: CSection: (none)Explanation

Explanation/Reference:You can get indexes indirectly by defining primary key and unique constraints.

QUESTION 99You are tasked with implementing a trigger. As part of the trigger’s code in specific conditions, you need to roll back the transaction. However, you need to copy the data from the inserted and deleted tables in the trigger into audit tables to keep track of what was supposed to be changed. Howcan you achieve this?

A. Roll back the transaction, and then copy the data from the inserted and deleted tables into the audit tables.

B. Copy the data from the inserted and deleted tables into the audit tables and then roll back the transaction.

C. Copy the rows from the inserted and deleted tables into temporary tables, roll back the transaction, and then copy the data from the temporary tables into theaudit tables.

D. Copy the rows from the inserted and deleted tables into table variables, roll back the transaction, and then copy the data from the table variables into the audittables.

Correct Answer: DSection: (none)

Page 266: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation

Explanation/Reference:

QUESTION 100What aggregation algorithms does SQL Server use? (Choose all that apply.)

A. Merge aggregation

B. Stream aggregation

C. Hash aggregation

D. Nested loops aggregation

Correct Answer: BCSection: (none)Explanation

Explanation/Reference:

QUESTION 101Which operator is used when SQL Server performs a nonclustered index seek to find a row, but then also needs data from the underlying table, which is organizedas a clustered index?

A. RID Lookup

B. Clustered Index Scan

C. Merge Join

D. Key Lookup

Correct Answer: DSection: (none)Explanation

Explanation/Reference:

QUESTION 102

Page 267: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

What is the scan called when SQL Server scans a clustered index in logical order of the index?

A. Allocation order scan

B. Clustered index scan

C. Index order scan

D. Index order seek

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 103What are possible reasons that SQL Server does not reuse an existing cached plan? (Choose all that apply.)

A. Because a SET option that influences the query result was changed

B. Because the query is manually parameterized in a stored procedure, and no recompilation option is used

C. Because SQL Server cannot determine the selectivity of the parameterized predicate

D. Because a different data type was used for a parameter in the parameterized predicate

Correct Answer: ACDSection: (none)Explanation

Explanation/Reference:

SQL Server does not reuse a cached plan if it cannot determine the selectivity of the parameterized predicate.

QUESTION 104What is the main advantage of batch mode processing?

A. It lowers the disk I/O.

B. It speeds up network transfer.

Page 268: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

C. It lowers the CPU burden.

D. It uses less memory.

Correct Answer: CSection: (none)Explanation

Explanation/Reference:

QUESTION 105Which of the following SET commands would prevent execution plan reusage?

A. SET STATISTICS IO ON

B. SET STATISTICS PROFILE ON

C. SET CONCAT_NULL_YIELDS_NULL OFF

D. SET STATISTICS IO OFF

Correct Answer: CSection: (none)Explanation

Explanation/Reference:The SET CONCAT_NULL_YIELDS_NULL command has an influence on the result of a query, and therefore changing this option prevents plan reusage.

QUESTION 106What kind of optimizer hints does SQL Server 2012 support? (Choose all that apply.)

A. Query

B. Join

C. Order

D. Table

Correct Answer: ABDSection: (none)Explanation

Page 269: 70-461 microsoft - GRATIS EXAM ·  70-461 microsoft Number : 70-461 Passing Score : 700 Time Limit : 120 min

http://www.gratisexam.com/

Explanation/Reference:

QUESTION 107What is not a type of plan guide?

A. JOIN

B. TEMPLATE

C. SQL

D. OBJECT

Correct Answer: ASection: (none)Explanation

Explanation/Reference:

http://www.gratisexam.com/