aiotestking uk

70-461 Exam Questions - Online Test


70-461 Premium VCE File

Learn More 100% Pass Guarantee - Dumps Verified - Instant Download
150 Lectures, 20 Hours

Q1. Your database contains a table named Purchases. The table includes a DATETIME column named PurchaseTime that stores the date and time each purchase is made. There is a non-clustered index on the PurchaseTime column. 

The business team wants a report that displays the total number of purchases made on the current day. 

You need to write a query that will return the correct results in the most efficient manner. 

Which Transact-SQL query should you use? 

A. SELECT COUNT(*) 

FROM Purchases 

WHERE PurchaseTime = CONVERT(DATE, GETDATE()) 

B. SELECT COUNT(*) 

FROM Purchases 

WHERE PurchaseTime = GETDATE() 

C. SELECT COUNT(*) 

FROM Purchases 

WHERE CONVERT(VARCHAR, PurchaseTime, 112) = CONVERT(VARCHAR, 

GETDATE(), 112) 

D. SELECT COUNT(*) 

FROM Purchases 

WHERE PurchaseTime >= CONVERT(DATE, GETDATE()) 

AND PurchaseTime < DATEADD(DAY, 1, CONVERT(DATE, GETDATE())) 

Answer:

Explanation: 

Two answers will return the correct results (the "WHERE CONVERT..." and "WHERE ... AND ... " answers). The correct answer for Microsoft would be the answer that 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 the shortest duration. Also, the query answer with "WHERE CONVERT..." threw warnings in the execution plan...something about affecting CardinalityEstimate and SeekPlan. 

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 

Q2. You are a database developer of a Microsoft SQL Server 2012 database. 

The database contains a table named Customers that has the following definition: 

You need 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 Orders 

ADD CONSTRAINT FX_Orders_CustomerID FOREIGN KEY (CustomerId) REFERENCES 

Customer (CustomerId) 

B. ALTER TABLE Customer 

ADD CONSTRAINT FK_Customer_CustomerID FOREIGN KEY {CustomerID) 

REFERENCES 

Orders (CustomerId) 

C. ALTER TABLE Orders 

ADD CONSTRAINT CK_Crders_CustomerID 

CHECK (CustomerId IN (SELECT CustomerId FROM Customer)) 

D. ALTER TABLE Customer 

ADD OrderId INT NOT NULL; 

ALTER TABLE Customer 

ADD CONSTRAINT FK_Customer_OrderID FOREIGN KEY (CrderlD) REFERENCES 

Orders 

(CrderlD); 

E. ALTER TABLE Orders 

ADD CONSTRAINT PK Orders CustomerId PRIMARY KEY (CustomerID) 

Answer:

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

Q3. CORRECT TEXT 

You have a view that was created by using the following code: 

You need to create an inline table-valued function named Sales.fn_OrdersByTerritory. Sales.fn_OrdersByTerritory must meet the following requirements: 

. Use one-part names to reference columns. 

. Return the columns in the same order as the order used in OrdersByTerritoryView. 

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

Answer:  

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

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

Which Transact-SQL query should you use? 

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

B. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS IF EXISTS(SELECT RetailPrice from inserted) OR EXISTS (SELECT WholeSalePnce FROM inserted) - - Create Audit Records 

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

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

Answer:

Q5. You develop three Microsoft SQL Server 2012 databases named Database1, Database2, and Database3. 

You have permissions on both Database1 and Database2. You plan to write and deploy a stored procedure named dbo.usp_InsertEvent in Database3. dbo.usp_InsertEvent must execute other stored procedures in the other databases. 

You need to ensure that callers that do not have permissions on Database1 or Database2 can execute the stored procedure. 

Which Transact-SQL statement should you use? 

A. USE Database2 

B. EXECUTE AS OWNER 

C. USE Database1 

D. EXECUTE AS CALLER 

Answer:

Q6. You administer a Microsoft SQL Server 2012 database that has multiple tables in the Sales schema. Some users must be prevented from deleting records in any of the tables in the Sales schema. You need to manage users who are prevented from deleting records in the Sales schema. 

You need to achieve this goal by using the minimum amount of administrative effort. What should you do? 

A. Create a custom database role that includes the users. Deny Delete permissions on the Sales schema for the custom database role. 

B. Include the Sales schema as an owned schema for the db_denydatawriter role. Add the users to the db_denydatawriter role. 

C. Deny Delete permissions on each table in the Sales schema for each user. 

D. Create a custom database role that includes the users. Deny Delete permissions on each table in the Sales schema for the custom database role. 

Answer:

Q7. You create a view based on the following statement: 

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 current month. 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 

Answer:

Q8. You administer a Microsoft SQL Server 2012 database. The database contains a Product table created by using the following definition: 

You need to ensure that the minimum amount of disk space is used to store the data in the Product table. 

What should you do? 

A. Convert all indexes to Column Store indexes. 

B. Implement Unicode Compression. 

C. Implement row-level compression. 

D. Implement page-level compression. 

Answer:

Q9. You are developing a database that will contain price information. You need to store the prices that include a fixed precision and a scale of six digits. Which data type should you use? 

A. Float 

B. Money 

C. Smallmoney 

D. Numeric 

Answer:

Explanation: 

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

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

Q10. CORRECT TEXT 

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

You need to create a query for a report. The query must meet the following requirements: 

NOT use object delimiters. 

Return the most recent orders first. 

Use the first initial of the table as an alias. 

Return the most recent order date for each customer. 

Retrieve the last name of the person who placed the order. 

Return the order date in a column named MostRecentOrderDate that appears as 

the last column in the report. The solution must support the ANSI SQL-99 standard. 

Which code segment should you use? 

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

Answer: