Categories
70-461 Dumps

70-461 Real Exam Dumps Questions and answers 51-60

Get Full Version of the Exam
http://www.EnsurePass.com/70-461.html

Question No.51

You are writing a set of queries against a FILESTREAM-enabled database. You 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 entire transaction is terminated and rolled back.

Which Transact-SQL statement should you include at the beginning of the stored procedure?

  1. SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

  2. SET XACT_ABORT OFF

  3. SET TRANSACTION ISOLATION LEVEL SNAPSHOT

  4. SET IMPLICIT_TRANSACTIONS ON

  5. SET XACT_ABORT ON

  6. SET IMPLICIT TRANSACTIONS OFF

Correct Answer: E

Explanation:

http://msdn.microsoft.com/en-us/libra ry/ms188792.aspx

Question No.52

You 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 an object that will prevent the applications from accessing the table directly while still providing access to the required data. You need to ensure that the following requirements are met:

  • Future modifications to the table definition will not affect the applications#39; 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 applications. What should you create for each application?

  1. Synonyms

  2. Common table expressions

  3. Views

  4. Temporary tables

Correct Answer: C

Explanation:

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

Question No.53

You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.)

image

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

image

Which Transact-SQL query should you use?

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers=CustomerId = 1

    FOR XML RAW, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML AUTO

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO

  6. SELECT Name, Country, Orderld, OrderDate, Amount

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

  7. SELECT Name AS #39;@Name#39;, Country AS #39;@Country#39;, OrderId, OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML PATH (#39;Customers#39;)

  8. SELECT Name AS #39;Customers/Name#39;, Country AS #39;Customers/Country#39;, OrderId, OrderDate, Amount

FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

FOR XML PATH (#39;Customers#39;)

Correct Answer: C

Explanation:

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

Question No.54

You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.)

image

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.

lt;CUSTOMERS Name=quot;Customer Aquot; Country=quot;Australiaquot;gt;

lt;ORDERS OrderID=quot;1quot; OrderDate=quot;2001-01-01quot; Amount=quot;3400.00quot; /gt;

lt;ORDERS OrderID=quot;2quot; OrderDate=quot;2002-01-01quot; Amount=quot;4300.00quot; /gt;

lt;/CUSTOMERSgt;

Which Transact-SQL query should you use?

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML AUTO

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId – Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO

  6. SELECT Name, Country, Orderld, OrderDate, Amount

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

  7. SELECT Name AS #39;@Name#39;, Country AS #39;@Country#39;, OrderId, OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML PATH (#39;Customers#39;)

  8. SELECT Name AS#39;Customers/Name#39;, Country AS #39;Customers/Country#39;, OrderId, OrderDate,

FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

FOR XML PATH (#39;Customers#39;)

Correct Answer: E

Question No.55

You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.)

image

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.

image

Which Transact-SQL query should you use?

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML AUTO

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId- 1

    FOR XML AUTO

  6. SELECT Name, Country, Orderld, OrderDate, Amount

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1 FOR XML AUTO, ELEMENTS

  7. SELECT Name AS #39;@Name#39;, Country AS #39;@Country#39;, OrderId, OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId=Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML PATH (#39;Customers#39;)

  8. SELECT Name AS#39;Customers/Name#39;, Country AS #39;Customers/Country#39;, OrderId,OrderDate, Amount

FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

FOR XML PATH (#39;Customers#39;)

Correct Answer: D

Question No.56

You 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 to be queried heavily, and you need to be able to index the column. Which Transact-SQL statement should you use?

  1. ALTER TABLE Inventory

    ADD TotalItems AS ItemslnStore ItemsInWarehouse

  2. ALTER TABLE Inventory

    ADD TotalItems AS ItemsInStore ItemsInWarehouse PERSISTED

  3. ALTER TABLE Inventory

    ADD TotalItems AS SUM(ItemsInStore,ItemsInWarehouse) PERSISTED

  4. ALTER TABLE Inventory

ADD TotalItems AS SUM(ItemsInStore, ItemsInWarehouse)

Correct Answer: B

Explanation:

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

Question No.57

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

image

You need to create an audit record only when either the MobileNumber or HomeNumber column is updated. Which Transact-SQL query should you use?

  1. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE

    AS

    IF COLUMNS_UPDATED (HomeNumber, MobileNumber)

    • – Create Audit Records

  2. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE

    AS

    IF EXISTS( SELECT HomeNumber FROM inserted) OR EXISTS (SELECT MobileNumber FROM inserted)

    • – Create Audit Records

  3. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE

    AS

    IF COLUMNS_CHANGED (HomeNumber, MobileNumber)

    • – Create Audit Records

  4. CREATE TRIGGER TrgPhoneNumberChange ON Customers FOR UPDATE

    AS

    IF UPDATE (HomeNumber) OR UPDATE (MobileNumber)

    • – Create Audit Records

Correct Answer: D

Explanation:

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

Question No.58

You develop a Microsoft SQL Server 2012 database that has two tables named SavingAccounts and LoanAccounts. Both tables have a column named AccountNumber 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 or LoanAccounts are inserted. Which Transact-SQL statement should you use?

  1. CREATE TRIGGER TrgValidateAccountNumber ON Transactions

    INSTEAD OF INSERT AS

    BEGIN

    INSERT INTO Transactions

    SELECT TransactionID,AccountNumber,Amount,TransactionDate FROM inserted WHERE AccountNumber IN

    (SELECT AccountNumber FROM LoanAccounts

    UNION SELECT AccountNumber FROM SavingAccounts)) END

  2. CREATE TRIGGER TrgValidateAccountNumber ON Transactions

    FOR INSERT AS

    BEGIN

    INSERT INTO Transactions

    SELECT TransactionID,AccountNumber,Amount,TransactionDate FROM inserted WHERE AccountNumber IN

    (SELECT AccountNumber FROM LoanAccounts

    UNION SELECT AccountNumber FROM SavingAccounts)) END

  3. CREATE TRIGGER TrgValidateAccountNumber ON Transactions

    INSTEAD OF INSERT AS

    BEGIN

    IF EXISTS (

    SELECT AccountNumber FROM inserted EXCEPT (SELECT AccountNumber FROM LoanAccounts

    UNION SELECT AccountNumber FROM SavingAccounts)) BEGIN

    ROLLBACK TRAN END

    END

  4. CREATE TRIGGER TrgValidateAccountNumber ON Transactions

FOR INSERT AS

BEGIN

IF EXISTS (

SELECT AccountNumber FROM inserted EXCEPT (SELECT AccountNumber FROM LoanAccounts

UNION SELECT AccountNumber FROM SavingAccounts)) BEGIN

ROLLBACK TRAN END

END

Correct Answer: A

Question No.59

You 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?

Convert the view into a table-valued function. Convert the view into a Common Table Expression (CTE). Convert the view into an indexed view.

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

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

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

  3. Convert the view into an indexed view.

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

Correct Answer: C

Explanation:

http://msdn.microsoft.com/en-us/libra ry/ms191432.aspx

Question No.60

You are a database developer of a Microsoft SQL Server 2012 database. The database contains a table named Customers that has the following definition:

image

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?

  1. ALTER TABLE Orders

    ADD CONSTRAINT FX_Orders_CustomerID FOREIGN KEY (CustomerId) REFERENCES Customer (CustomerId)

  2. ALTER TABLE Customer

    ADD CONSTRAINT FK_Customer_CustomerID FOREIGN KEY {Cu3tomerID; REFERENCES Orders (CustomerId)

  3. ALTER TABLE Orders

    ADD CONSTRAINT CK_Crders_CustomerID

    CHECK (CustomerId IN (SELECT CustomerId FROM Customer))

  4. ALTER TABLE Customer

    ADD OrderId INT NOT NULL;

    ALTER TABLE Customer

    ADD CONSTRAINT FK_Customer_OrderID FOREIGN KEY (CrderlD) REFERENCES Orders (CrderlD);

  5. ALTER TABLE Orders

ADD CONSTRAINT PK Orders CustomerId PRIMARY KEY (CustomerID)

Correct Answer: A

Explanation:

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

Get Full Version of 70-461 Dumps

Categories
70-461 Dumps

70-461 Real Exam Dumps Questions and answers 61-70

Get Full Version of the Exam
http://www.EnsurePass.com/70-461.html

Question No.61

You develop a Microsoft SQL Server 2012 database. You create a view from the Orders and OrderDetails tables by using the following definition.

image

You need to ensure that users are able to modify data by using the view. What should you do?

  1. Create an AFTER trigger on the view.

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

  3. Create an INSTEAD OF trigger on the view.

  4. Modify the view to an indexed view.

Correct Answer: C

Explanation:

http://msdn.microsoft.com/en-us/libra ry/ms187956.aspx

Question No.62

You have three tables that contain data for dentists, psychiatrists, and physicians. You create a view that is used to look up their email addresses and phone numbers. The view has the following definition:

image

You need to ensure that users can update only the phone numbers and email addresses by using this view. What should you do?

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

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

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

  4. Create an AFTER UPDATE trigger on the view.

Correct Answer: B

Explanation

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

Question No.63

Your database contains tables named Products and ProductsPriceLog. The Products table contains columns named ProductCode and Price. The ProductsPriceLog table contains columns named ProductCode, OldPrice, and NewPrice. The ProductsPriceLog table stores the previous price in the OldPrice column and the new price 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 the changes to the ProductsPriceLog table. Which Transact-SQL query should you use?

  1. UPDATE Products SET Price = Price * 1.05

    OUTPUT inserted.ProductCode, deleted.Price, inserted.Price INTO ProductsPriceLog(ProductCode, OldPrice, NewPrice)

  2. UPDATE Products SET Price = Price * 1.05

    OUTPUT inserted.ProductCode, inserted.Price, deleted.Price INTO ProductsPriceLog(ProductCode, OldPrice, NewPrice)

  3. UPDATE Products SET Price = Price * 1.05

    OUTPUT inserted.ProductCode, deleted.Price, inserted.Price * INTO ProductsPriceLog(ProductCode, OldPrice, NewPrice)

  4. UPDATE Products SET Price = Price * 1.05

INSERT INTO ProductsPriceLog (ProductCode, CldPnce, NewPrice; SELECT ProductCode, Price, Price * 1.05 FROM Products

Correct Answer: A

Explanation:

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

Question No.64

You are developing a database application by using Microsoft SQL Server 2012. An application that uses a database begins to run slowly. Your investigation shows the 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?

  1. Add a HASH hint to the query.

  2. Add a LOOP hint to the query.

  3. Add a FORCESEEK hint to the query.

  4. Add an INCLUDE clause to the index.

  5. Add a FORCESCAN hint to the Attach query.

  6. Add a columnstore index to cover the query.

  7. Enable the optimize for ad hoc workloads option.

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

  9. Include a SET FORCEPLAN ON statement before you run the query.

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

  11. Include a SET STATISTICS SHOWPLAN_XML ON statement before you run the query.

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

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

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

Correct Answer: F

Question No.65

You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.)

image

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.

image

Which Transact-SQL query should you use?

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers-CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers=CustomerId = 1

    FOR XML RAW, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML AUTO

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId – Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId- 1

    FOR XML AUTO

  6. SELECT Name, Country, Crderld, OrderDate, Amount

    FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

  7. SELECT Name AS #39;@Name#39;, Country AS #39;@Country#39;, OrderId, OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML PATH (#39;Customers#39;)

  8. SELECT Name AS #39;Customers/Name#39;, Country AS #39;Customers/Country#39;, OrderId, OrderDate, Amount

FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

FOR XML PATH (#39;Customers#39;)

Correct Answer: F

Question No.66

You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.)

image

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.

image

Which Transact-SQL query should you use?

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

    FROM Orders INNER JOINCustomers ON Orders.CustomerId = Customers-CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW

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

    FROM Orders INNER JOINCustomers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW, ELEMENTS

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

    FROM Orders INNER JOINCustomers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML AUTO

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

    FROM Orders INNER JOINCustomers ON Orders.CustomerId – Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

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

    FROM Orders INNER JOINCustomers ON Orders.CustomerId=Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO

  6. SELECT Name, Country, Crderld, OrderDate, Amount

    FROM Orders INNER JOINCustomers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

  7. SELECT Name AS #39;@Name#39;, Country AS #39;@Country#39;, OrderId, OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML PATH (#39;Customers#39;)

  8. SELECT Name AS #39;Customers/Name#39;, Country AS #39;Customers/Country#39;, OrderId,OrderDate, FROM OrdersINNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId

WHERE Customers.CustomerId= 1 FOR XML PATH (#39;Customers#39;)

Correct Answer: G

Question No.67

You use Microsoft SQL Server 2012 to write code for a transaction that contains several statements. There is high contention between readers and writers on several tables used by your transaction. You need to minimize the use of the tempdb space. You also need to prevent reading queries from blocking writing queries. Which isolation level should you use?

  1. SERIALIZABLE

  2. SNAPSHOT

  3. READ COMMITTED SNAPSHOT

  4. REPEATABLE READ

Correct Answer: C

Explanation:

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

Question No.68

You create a table that has the StudentCode, SubjectCode, and Marks columns to record mid- year marks for students. The table has marks obtained by 50 students for various subjects. You need to ensure that the 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 of 2. Which Transact-SQL query should you use?

  1. SELECT StudentCode as Code,

    RANK ( ) OVER (ORDER BY AVG (Marks) DESC) AS Value FROM StudentMarks GROUP BY StudentCode

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

  3. SELECT StudentCode as Code,

    DENSE_RANK () OVER (ORDER BY AVG (Marks) DESC) AS Value FROM StudentMarks GROUP BY StudentCode

  4. SELECT StudentCode as Code,

    NTILE (2) OVER (ORDER BY AVG (Marks) DESC) AS Value FROM StudentMarks GROUP BY StudentCode

  5. SELECT StudentCode AS Code,Marks AS Value FROM (SELECT StudentCode, Marks AS Marks,

    RANK () OVER (PARTITION BY SubjectCode ORDER BY Marks ASC) AS Rank FROM StudentMarks) tmp WHERE Rank = 1

  6. 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) tmp WHERE Rank = 1

  7. 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) tmp WHERE Rank = 1

  8. 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) tmp WHERE Rank = 1

Correct Answer: D

Question No.69

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

  • Students must be ranked based on their average marks.

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

  • Consecutive ranks must be skipped when the same rank is assigned.

Which Transact-SQL query should you use?

  1. SELECT StudentCode as Code,

    RANK ( ) OVER (ORDER BY AVG (Marks) DESC) AS Value

    FROM StudentMarks GROUP BY StudentCode

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

  3. SELECT StudentCode as Code,

    DENSE_RANK () OVER (ORDER BY AVG (Marks) DESC) AS Value

    FROM StudentMarks GROUP BY StudentCode

  4. SELECT StudentCode as Code,

    NTILE (2) OVER (ORDER BY AVG (Marks) DESC) AS Value

    FROM StudentMarks GROUP BY StudentCode

  5. SELECT StudentCode AS Code,Marks AS Value FROM (SELECT StudentCode, Marks AS Marks,

    RANK () OVER (PARTITION BY SubjectCode ORDER BY Marks ASC) AS Rank

    FROM StudentMarks) tmp WHERE Rank = 1

  6. SELECT StudentCode AS Code,Marks AS Value FRCM ( SELECT StudentCode, Marks AS Marks,

    RANK() OVER (PARTITION BY SubjectCode ORDER 3Y Marks DESC) AS Rank

    FROM StudentMarks) tmp WHERE Rank = 1

  7. 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) tmp WHERE Rank = 1

  8. 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) tmp WHERE Rank = 1

Correct Answer: A

Explanation:

http://msdn.microsoft.com/en-us/libra ry/ms189798.aspx

Question No.70

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

  1. SELECT StudentCode as Code,

    RANK ( ) OVER (ORDER BY AVG (Marks) DESC) AS Value

    FROM StudentMarks GROUP BY StudentCode

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

  3. SELECT StudentCode as Code,

    DENSE_RANK () OVER (ORDER BY AVG (Marks) DESC) AS Value

    FROM StudentMarks GROUP BY StudentCode

  4. SELECT StudentCode as Code,

    NTILE (2) OVER (ORDER BY AVG (Marks) DESC) AS Value

    FROM StudentMarks GROUP BY StudentCode

  5. SELECT StudentCode AS Code,Marks AS Value FROM (SELECT StudentCode, Marks AS Marks,

    RANK () OVER (PARTITION BY SubjectCode ORDER BY Marks ASC) AS Rank

    FROM StudentMarks) tmp WHERE Rank = 1

  6. 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) tmp WHERE Rank = 1

  7. 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) tmp WHERE Rank = 1

  8. 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) tmp WHERE Rank = 1

Correct Answer: F

Get Full Version of 70-461 Dumps

Categories
70-461 Dumps

70-461 Real Exam Dumps Questions and answers 1-10

Get Full Version of the Exam
http://www.EnsurePass.com/70-461.html

Question No.1

You 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 statement should you use?

  1. ALTER TABLE InventoryADD TotalItems AS ItemsInStore ItemsInWarehouse

  2. ALTER TABLE InventoryADD ItemsInStore – ItemsInWarehouse = TotalItems

  3. ALTER TABLE InventoryADD TotalItems = ItemsInStore ItemsInWarehouse

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

Correct Answer: A

Explanation:

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

Question No.2

You develop a Microsoft SQL Server 2012 database. You create a view from the Orders and OrderDetails tables by using the following definition.

image

You need to improve the performance of the view by persisting data to disk. What should you do?

  1. Create an INSTEAD OF trigger on the view.

  2. Create an AFTER trigger on the view.

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

  4. Create a clustered index on the view.

Correct Answer: D

Explanation:

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

Question No.3

You 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 store the departure and arrival dates and times of flights along with time zone information. What should you do?

  1. Use the CAST function.

  2. Use the DATE data type.

  3. Use the FORMAT function.

  4. Use an appropriate collation.

  5. Use a user-defined table type.

  6. Use the VARBINARY data type.

  7. Use the DATETIME data type.

  8. Use the DATETIME2 data type.

  9. Use the DATETIMEOFFSET data type.

  10. Use the TODATETIMEOFFSET function.

Correct Answer: I

Explanation:

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

Question No.4

You develop a database for a travel application. You need to design tables and other database objects. You create a stored procedure. You need to supply the stored procedure with multiple event names and their dates as parameters. What should you do?

  1. Use the CAST function.

  2. Use the DATE data type.

  3. Use the FORMAT function.

  4. Use an appropriate collation.

  5. Use a user-defined table type.

  6. Use the VARBINARY data type.

  7. Use the DATETIME data type.

  8. Use the DATETIME2 data type.

  9. Use the DATETIMEOFFSET data type.

  10. Use the TODATETIMEOFFSET function.

Correct Answer: E

Question No.5

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

image

You need to create an inline table-valued function named Sales.fn_OrdersByTerritory, which 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.

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

Correct Answer:

CREATE FUNCTION Sales.fn_OrdersByTerritory (@T int) RETURNS TABLE

AS RETURN (

SELECT OrderID,OrderDate,SalesTerrirotyID,TotalDue FROM Sales.OrdersByTerritory

WHERE SalesTerritoryID = @T

)

Question No.6

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

image

You deploy a new server that has SQL Server 2012 installed. You need to create a table named Sales.OrderDetails on the new server. Sales.OrderDetails must meet the following requirements:

  • Write the results to a disk.

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

  • The code must NOT use any object delimiters.

The solution must ensure that LineItemTotal is stored as the last column in the table. Which code segment should you use? To answer, type the correct code in the answer area.

Correct Answer:

CREATE TABLE Sales.OrderDetails ( ListPrice money not null, Quantity int not null,

LineItemTotal as (ListPrice * Quantity) PERSISTED)

Explanation:

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

Question No.7

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

image

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#39;s default schema.

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

Correct Answer:

CREATE VIEW Sales.uv_CustomerFullName WITH SCHEMABINDING

AS

SELECT FirstName, LastName FROM Sales.Customers

Explanation:

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

Question No.8

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

image

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:

SELECT OrderID, SUM(ExtendedAmount) AS TotalSales FROM Sales.Details

GROUP BY OrderID ORDER BY OrderID

Question No.9

You have 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 include customers who have not placed any orders.

Which Transact-SQL query should you use?

  1. SELECT CustomerName, OrderDateFROM Customers RIGHT OUTER JOIN Orders ON Customers. CustomerID = Orders.CustomerID

  2. SELECT CustomerName, CrderDateFROM Customers JOIN Orders ON Customers.CustomerID = Orders.CustomerID

  3. SELECT CustomerName, OrderDateFROM Customers CROSS JOIN Orders ON Customers.CustomerID

    = Orders.CustomerID

  4. SELECT CustomerName, OrderDateFROM Customers LEFT OUTER JOIN Orders ON Customers. CustomerID = Orders.CustomerID

Correct Answer: D

Explanation:

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

Question No.10

You 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 entire transaction is terminated and rolled back. Which Transact-SQL statement should you include at the beginning of the stored procedure?

  1. SET XACT_ABORT ON

  2. SET ARITHABORT ON

  3. TRY

  4. BEGIN

  5. SET ARITHABORT OFF

  6. SET XACT_ABORT OFF

Correct Answer: A

Explanation:

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

Get Full Version of 70-461 Dumps

Categories
70-461 Dumps

70-461 Real Exam Dumps Questions and answers 11-20

Get Full Version of the Exam
http://www.EnsurePass.com/70-461.html

Question No.11

Your database contains two tables named DomesticSalesOrders and InternationalSalesOrders. Both tables contain more than 100 million rows. Each table has a Primary Key column named SalesOrderId. The data in the two tables is distinct from one another. Business users want a report that includes aggregate information about 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 you use?

  1. SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount

    FROM (SELECT SalesOrderId, SalesAmountFROM DomesticSalesOrders

    UNION ALL SELECT

    SalesOrderId, SalesAmountFROM

    InternationalSalesOrder s ) AS p

  2. SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount

    FROM (SELECT SalesOrderId, SalesAmountFROM DomesticSalesOrders

    UNION SELECT

    SalesOrderId, SalesAmountFROM

    InternationalSalesOrder s ) AS p

  3. SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS

    TotalSalesAmountFROM DomesticSalesOrders UNION SELECT COUNT(*) AS

    NumberOfSales, SUM(SalesAmount) AS

    TotalSalesAmountFROM InternationalSalesOrders

  4. SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS

TotalSalesAmountFROM DomesticSalesOrders UNION ALL SELECT COUNT(*) AS NumberOfSales,

SUM(SalesAmount) AS

TotalSalesAmountFROM InternationalSalesOrders

Correct Answer: A

Explanation:

http://msdn.microsoft.com/en-us/library/ms180026.aspx http://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs-union-all-

optimal-performance-comparison/

Question No.12

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

  1. ENCRYPTBYKEY

  2. ENCRYPTION

  3. ENCRYPTBYPASSPHRASE

  4. ENCRYPTBYCERT

Correct Answer: B

Explanation:

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

Question No.13

You use a Microsoft SQL Server 2012 database. You want to create a table to store Microsoft Word documents. You need to ensure that the documents must only be accessible via Transact- SQL queries. Which Transact-SQL statement should you use?

  1. CREATE TABLE DocumentStore ( [Id] INT NOT NULL PRIMARY KEY, [Document]

    VARBINARY(MAX) NULL

    )GO

  2. CREATE TABLE DocumentStore ( [Id] hierarchyid,[Document] NVARCHAR NOT NULL

    )GO

  3. CREATE TABLE DocumentStore AS FileTable

  4. CREATE TABLE DocumentStore ( [Id] [uniqueidentifier] ROWGUIDCOL NOT NULL UNIQUE,[Document]

VARBINARY(MAX) FILESTREAM NULL

)GO

Correct Answer: A

Explanation:

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

Question No.14

You administer a Microsoft SQL Server 2012 database that contains a table named OrderDetail. You discover that the NCI_OrderDetail_CustomerID non-clustered index is fragmented. You need to reduce fragmentation. You need to achieve this goal without taking the index offline. Which Transact-SQL batch should you use?

  1. CREATE INDEX NCI_OrderDetail_CustomerI D ON

    OrderDetail.CustomerID WITH DROP EXISTING

  2. ALTER INDEX

    NCI_OrderDetail_CustomerID ON OrderDetail.CustomerID REORGANIZE

  3. ALTER INDEX ALL ON OrderDetail REBUILD

  4. ALTER INDEX

NCI_OrderDetail_CustomerID ON OrderDetail.CustomerID REBUILD

Correct Answer: B

Explanation:

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

Question No.15

You 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 an object that will prevent the applications from accessing the table directly while still providing access to the required data. You need to ensure that the following requirements are met:

  • Future modifications to the table definition will not affect the applications#39; 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 theexisting applications.

What should you create for each application?

  1. views

  2. table partitions

  3. table-valued functions

  4. stored procedures

Correct Answer: A

Question No.16

You 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?

  1. Inline user-defined function

  2. Stored procedure

  3. Table-valued user-defined function

  4. Scalar user-defined function

Correct Answer: C

Question No.17

You develop a Microsoft SQL Server 2012 database. You need to create and call a stored procedure that meets the following requirements:

Accepts a single input parameter for CustomerID. Returns a single integer to the calling application. Which Transact-SQL statement or statements should you use? (Each correct answer presents part of the solution. Choose all that apply.)

  1. CREATE PROCEDURE dbo.GetCustomerRating @Customer INT,

    @CustomerRatIng INT OUTPUT AS SET NOCOUNT ON SELECT @CustomerRating = CustomerOrders/CustomerValue FROM Customers WHERE CustomerID = @CustomerID RETURN GO

  2. EXECUTE dbo.GetCustomerRatIng 1745

  3. DECLARE

    @customerRatingBycustomer INT DECLARE @Result INT EXECUTE @Result = dbo.GetCustomerRating 1745 , @CustomerRatingSyCustomer

  4. CREATE PROCEDURE

    dbo.GetCustomerRating @CustomerID INT,

    @CustomerRating INT OUTPUT AS SET NOCOUNT ON SELECT @Result =

    CustomerOrders/CustomerValue FROM Customers WHERE CustomerID = @CustomeriD RETURN @Result GO

  5. DECLARE

    @CustomerRatIngByCustcmer INT EXECUTE dbo.GetCustomerRating @CustomerID = 1745,

    @CustomerRating =

    @CustomerRatingByCustomer OUTPUT

  6. CREATE PROCEDURE

dbo.GetCustomerRating @CustomerID INT AS DECLARE @Result INT SET NOCOUNT ON SELECT @Result =

CustomerOrders/CustomerVaLue FROM Customers WHERE Customer= = @CustomerID R ETURNS @Result

Correct Answer: AE

Question No.18

You 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 CompletedOrders

You need to optimize transaction logging and locking for the statement. Which table hint should you use?

  1. HOLDLOCK

  2. ROWLOCK

  3. XLOCK

  4. UPDLOCK

  5. TABLOCK

Correct Answer: E

Explanation:

http://technet.microsoft.com/en-us/library/ms189857.aspx

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

Question No.19

You use a Microsoft SQL Server 2012 database that contains two tables named SalesOrderHeader and SalesOrderDetail. The indexes on the tables are as shown in the exhibit. (Click the Exhibit button.)

image

You write the following Transact-SQL query:

image

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 for SalesOrderHeader by using an

unexpected index on SalesOrderDetail. You need to improve the performance of the query. What should you do?

  1. Use a FORCESCAN hint in the query.

  2. Add a clustered index on SalesOrderId in SalesOrderHeader.

  3. Use a FORCESEEK hint in the query.

  4. Update statistics on SalesOrderId on both tables.

Correct Answer: D

Explanation:

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

Question No.20

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?

  1. SELECT COUNT(*)FROM Purchases WHERE PurchaseTime = CONVERT(DATE, GETDATE())

  2. SELECT COUNT(*)FROM Purchases WHERE PurchaseTime = GETDATE()

  3. SELECT COUNT(*)FROM Purchases WHERE CONVERT(VARCHAR,

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

  4. SELECT COUNT(*)FROM Purchases WHERE PurchaseTime gt;=

CONVERT(DATE, GETDATE()) AND PurchaseTime lt; DATEADD(DAY, 1,

CONVERT(DATE, GETDATE()))

Correct Answer: D

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

Get Full Version of 70-461 Dumps

Categories
70-461 Dumps

70-461 Real Exam Dumps Questions and answers 21-30

Get Full Version of the Exam
http://www.EnsurePass.com/70-461.html

Question No.21

You 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 media file is less than 1 MB in size. The media files will require fast access and will be retrieved frequently. What should you do?

  1. Use the CAST function.

  2. Use the DATE data type.

  3. Use the FORMAT function.

  4. Use an appropriate collation.

  5. Use a user-defined table type.

  6. Use the VARBINARY data type.

  7. Use the DATETIME data type.

  8. Use the DATETIME2 data type.

  9. Use the DATETIMEOFFSET data type.

  10. Use the TODATETIMEOFFSET function.

Correct Answer: F

Explanation:

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

Question No.22

You 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 the airline schedules on a report. You need to display dates and times in several international formats. What should you do?

  1. Use the CAST function.

  2. Use the DATE data type.

  3. Use the FORMAT function.

  4. Use an appropriate collation.

  5. Use a user-defined table type.

  6. Use the VARBINARY data type.

  7. Use the DATETIME data type.

  8. Use the DATETIME2 data type.

  9. Use the DATETIMEOFFSET data type.

  10. Use the TODATETIMEOFFSET function.

Correct Answer: C

Explanation:

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

Question No.23

You 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 table will 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 the following table.

image

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 order of SourceID and then CustomerID. Which Transact- SQL statement should you use?

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

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

  3. CREATE TABLE Customer (SourceID int NOT NULL PRIMARY KEY CLUSTERED,CustomerID int NOT NULL

    UNIQUE,CustomerName varchar(255) NOT NULL);

  4. 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: D

Question No.24

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

image

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

image

Users are able to use single INSERT statements or INSERT…SELECT statements into this view. You need to ensure that users are able to use a single statement to insert records into both Employee and Person tables by using the VwEmployee view.

Which Transact-SQL statement should you use?

  1. CREATE TRIGGER TrgVwEmployee ON VwEmployee

    FOR INSERT AS

    BEGIN

    INSERT INTO Person(Id, FirstName, LastName) SELECT Id, FirstName, LastName, FROM inserted INSERT INTO Employee(PersonId, EmployeeNumber) SELECT Id, EmployeeNumber FROM inserted

    END

  2. CREATE TRIGGER TrgVwEmployee ON VwEmployee

    INSTEAD OF INSERT AS

    BEGIN

    INSERT INTO Person(Id, FirstName, LastName) SELECT Id, FirstName, LastName, FROM inserted INSERT INTO Employee(PersonId, EmployeeNumber) SELECT Id, EmployeeNumber FROM inserted

    END

  3. CREATE TRIGGER TrgVwEmployee ON VwEmployee

    INSTEAD OF INSERT AS

    BEGIN

    DECLARE @ID INT, @FirstName NVARCHAR(25), @LastName NVARCHAR(25), @PersonID INT,

    @EmployeeNumber NVARCHAR(15)

    SELECT @ID = ID, @FirstName = FirstName, @LastName = LastName, @EmployeeNumber = EmployeeNumber

    FROM inserted

    INSERT INTO Person(Id, FirstName, LastName) VALUES(@ID, @FirstName, @LastName)

    INSERT INTO Employee(PersonID, EmployeeNumber) VALUES(@PersonID, @EmployeeNumber

    End

  4. CREATE TRIGGER TrgVwEmployee ON VwEmployee

INSTEAD OF INSERT AS

BEGIN

INSERT INTO Person(Id, FirstName, LastName) SELECT Id, FirstName, LastName FROM VwEmployee INSERT INTO Employee(PersonID, EmployeeNumber) SELECT Id, EmployeeNumber FROM VwEmployee

End

Correct Answer: B

Question No.25

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?

image

  1. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS IF CCLUMNS_CHANGED(RetailPrice, WholesalePrice)

    • – Create Audit Records

  2. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS IF EXISTS(SELECT RetailPrice from inserted) OR

    EXISTS (SELECT WholeSalePnce FROM inserted)

    • – Create Audit Records

  3. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS IF COLUMNS_UPDATED(RetailPrice, WholesalePrice)

    • – Create Audit Records

  4. CREATE TRIGGER TrgPriceChange ON Products FOR UPDATE AS IF UPDATE(RetailPrice) OR UPDATE(WholeSalePrice)

    • – Create Audit Records

Correct Answer: D

Explanation:

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

Question No.26

You 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. The view has the following definition:

image

You need to ensure that users can update only the phone numbers by using this view. What should you do?

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

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

  3. Create an AFTER UPDATE trigger on the view.

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

Correct Answer: D

Explanation:

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

Question No.27

A 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 a report that displays the profits made by each territory for each year and its previous year. Which Transact-SQL query should you use?

  1. SELECT Territory, Year, Profit,

    LEAD(Profit, 1, 0) OVER (PARTITION BY Territory ORDER BY Year) ASPrevProfit FROM Profits

  2. SELECT Territory, Year, Profit,

    LAG(Profit, 1, 0) OVER (PARTITION BY Year ORDER BY Territory) ASPrevProfit FROM Profits

  3. SELECT Territory, Year, Profit,

    LAG(Profit, 1, 0) OVER (PARTITION BY Territory ORDER BY Year) ASPrevProfit FROM Profits

  4. SELECT Territory, Year, Profit,

LEAD(Profit, 1, 0) OVER (PARTITION BY Year ORDER BY Territory) ASPrevProfit FROM Profits

Correct Answer: C

Explanation:

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

Question No.28

You 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?

  1. CROSS JOIN

  2. CROSS APPLY

  3. PIVOT

  4. UNPIVOT

Correct Answer: C

Explanation:

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

Question No.29

You 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 not have a sales person. Which Transact- SQL query or queries should you use? (Each correct answer presents a complete solution. Choose all that apply.)

  1. SELECT CustomerID FROM Customer WHERE TerritoryID lt;gt; SOME(SELECT TerritoryID FROM Salesperson)

  2. SELECT CustomerID FROM Customer WHERE TerritoryID lt;gt; ALL(SELECT TerritoryID

    FROM Salesperson)

  3. SELECT CustomerID FROM Customer WHERE TerritoryID lt;gt; ANY(SELECT TerritoryID FROM Salesperson)

  4. SELECT CustomerID FROM Customer WHERE TerritoryID NOT IN(SELECT TerritoryID FROM Salesperson)

Correct Answer: BD

Question No.30

You support a database structure shown in the exhibit. (Click the Exhibit button.)

image

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?

  1. SELECT SalesPerson.Name, Country, City,DatePart(yyyy,

    SaleDate) AS Year,

    Sum(Amount) AS TotalFROM Sale INNER JOIN SalesPerson ON Sale.SalesPersonID = SalesPerson.SalesPersonID GROUP BY GROUPING

    SETS((SalesPerson.Name, Country, City, DatePart(yyyy,SaleDate)), (Country, City), (Country), ())

  2. SELECT SalesPerson.Name, Country, City,DatePart(yyyy,

    SaleDate) AS Year,

    Sum(Amount) AS TotalFROM Sale INNER JOIN SalesPerson ON Sale.SalesPersonID = SalesPerson.SalesPersonID GROUP BY

    CUBE(SalesPerson.Name, Country, City, DatePart(yyyy, SaleDate))

  3. SELECT SalesPerson.Name, Country, City,DatePart(yyyy,

    SaleDate) AS Year,

    Sum(Amount) AS TotalFROM Sale INNER JOIN SalesPerson ON Sale.SalesPersonID = SalesPerson.SalesPersonID GROUP BY

    CUBE(SalesPerson.Name, DatePart(yyyy, SaleDate), City, Country)

  4. SELECT SalesPerson.Name, Country, City,DatePart(yyyy,

SaleDate) AS Year,

Sum(Amount) AS TotalFROM Sale INNER JOIN SalesPerson ON Sale.SalesPersonID = SalesPerson.SalesPersonID GROUP BY

ROLLUP(SalesPerson.Name, DatePart(yyyy, SaleDate), City, Country)

Correct Answer: A

Explanation:

http://www.grapefruitmoon.net/diving-into-t-sql-grouping-sets/ http://msdn.microsoft.com/en-us/library/ms177673.aspx

Get Full Version of 70-461 Dumps

Categories
70-461 Dumps

70-461 Real Exam Dumps Questions and answers 31-40

Get Full Version of the Exam
http://www.EnsurePass.com/70-461.html

Question No.31

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?

  1. Float

  2. Money

  3. Smallmoney

  4. Numeric

Correct Answer: D

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 No.32

You administer a Microsoft SQL Server database that supports a banking transaction management application. You need to retrieve a list of account holders who live 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 all that apply.)

  1. SELECT AccountHolderID FROM AccountHolder WHERE CityID NOT IN (SELECT CityID FROM BranchMaster)

  2. SELECT AccountHolderID FROM AccountHolder WHERE CityID lt;gt; ALL (SELECT CityID FROM BranchMaster)

  3. SELECT AccountHolderlD FROM AccountHolder WHERE CityID lt;gt; SOME (SELECT CityID FROM BranchMaster)

  4. SELECT AccountHolderID FROM AccountHolder WHERE CityID lt;gt; ANY (SELECT CityID FROM BranchMaster)

Correct Answer: AB

Explanation:

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

Question No.33

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. (Click the Exhibit button.)

image

image

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

  1. DateHired

  2. DepartmentID

  3. EmployeelD

  4. EmployeeNum

  5. FirstName

  6. JobTitle

  7. LastName

  8. MiddleName

  9. ReportsToID

Correct Answer: D

Question No.34

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. (Click the Exhibit button.)

image

image

Confidential information about the employees is stored in a separate table named EmployeeData. One record exists within EmployeeData for each record in the Employee table.

You need to assign the appropriate constraints and table properties to ensure data integrity and visibility. On which column in the Employee table should you use an identity specification to include a seed of 1,000 and an increment of 1?

  1. DateHired

  2. DepartmentID

  3. EmployeeID

  4. EmployeeNum

  5. FirstName

  6. JobTitle

  7. LastName

  8. MiddleName

  9. ReportsToID

Correct Answer: C

Question No.35

You administer a Microsoft SQL Server 2012 database that includes a table named Products. The Products table has columns named Productld, ProductName, and CreatedDateTime. The table contains a unique constraint on the combination of ProductName and CreatedDateTime. You need to modify the Products table to meet 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?

  1. WITH CTEDupRecords AS

    (

    SELECT MAX(CreatedDateTime) AS CreatedDateTime, ProductName FROM Products

    GROUP BY ProductName HAVING COUNT(*) gt; 1

    )

    DELETE p

    FROM Products p

    JOIN CTEDupRecords cte ON p.ProductName = cte.ProductName

    AND p.CreatedDateTime gt; cte.CreatedDateTime

  2. WITH CTEDupRecords AS

    (

    SELECT MAX(CreatedDateTime) AS CreatedDateTime, ProductName FROM Products

    GROUP BY ProductName HAVING COUNT(*) gt; 1

    )

    DELETE p

    FROM Products p

    JOIN CTEDupRecords cte ON cte.ProductName = p.ProductName

    AND cte.CreatedDateTime gt; p.CreatedDateTime

  3. WITH CTEDupRecords AS

    (

    SELECT MIN(CreatedDateTime) AS CreatedDateTime, ProductName FROM Products

    GROUP BY ProductName

    )

    DELETE p

    FROM Products p

    JOIN CTEDupRecords cte ON p.ProductName = cte.ProductName

  4. WITH CTEDupRecords AS

(

SELECT MAX(CreatedDateTime) AS CreatedDateTime, ProductName FROM Products

GROUP BY ProductName HAVING COUNT(*) gt; 1

) DELETE p

FROM Products p

JOIN CTEDupRecords cte ON p.ProductName = cte.ProductName

Correct Answer: B

Question No.36

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?

  1. USE Database2

  2. EXECUTE AS OWNER

  3. USE Database1

  4. EXECUTE AS CALLER

Correct Answer: B

Explanation:

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

http://blog.sqlauthority.com/2007/10/0 6/sql-server-executing-remote-stored-procedure-calling- stored-procedure-on-linked-server/

Question No.37

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?

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

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

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

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

Correct Answer: A

Question No.38

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

image

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?

  1. Convert all indexes to Column Store indexes.

  2. Implement Unicode Compression.

  3. Implement row-level compression.

  4. Implement page-level compression.

Correct Answer: D

Explanation:

http://msdn.microsoft.com/en-us/library/cc280449.aspx http://msdn.microsoft.com/en-us/library/cc280464.aspx http://msdn.microsoft.com/en-us/library/cc280576.aspx http://msdn.microsoft.com/en-us/library/ee240835.aspx

Question No.39

You generate a daily report according to the following query:

image

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

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

    WITH cte(CustomerID, LastOrderDate) AS (

    SELECT CustomerID, MAX(OrderDate) AS [LastOrderDate] FROM Sales.SalesOrder

    GROUP BY CustomerID

    )

    SELECT c.CustomerName FROM cte

    INNER JOIN Sales.Customer c

    ON cte.CustomerID = c.CustomerID

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

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

    SELECT c.CustomerName FROM Sales.Customer c WHERE NOT EXISTS (

    SELECT s.OrderDate FROM Sales.SalesOrder

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

    AND s.CustomerID = c.CustomerID)

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

    SELECT DISTINCT c.CustomerName FROM Sales.Customer c

    INNER JOIN Sales.SalesOrder s ON c.CustomerID = s.CustomerID

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

  4. Rewrite the report query as follows:

SELECT c.CustomerName FROM Sales.Customer c

WHERE NOT EXISTS (SELECT OrderDate FROM Sales.ufnGetRecentOrders(c.CustomerID, 90))

Rewrite the UDF as follows:

CREATE FUNCTION Sales.ufnGetRecentOrders(@CustomerID int, @MaxAge datetime) RETURNS TABLE AS RETURN (

SELECT OrderDate

FROM Sales.SalesOrder

WHERE s.CustomerID = @CustomerID

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

Correct Answer: A

Question No.40

You administer a Microsoft SQL Server 2012 database named ContosoDb. Tables are defined as shown in the exhibit. (Click the Exhibit button.)

image

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:

lt;row OrderId=quot;1quot;

OrderDate=quot;2000-01-01T00:00 :00quot; Amount=quot;3400.00quot; Name=quot;Customer Aquot; Country=quot;Australiaquot; /gt;lt;row OrderId=quot;2quot;

OrderDate=quot;2001-01-01T00:00 :00quot; Amount=quot;4300.00quot; Name=quot;Customer Aquot; Country=quot;Australiaquot; /gt;

Which Transact-SQL query should you use?

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML RAW, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId = Customers.CustomerId WHERE Customers.CustomerId = 1

    FOR XML AUTO

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId – Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

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

    FROM Orders INNER JOIN Customers ON Orders.CustomerId=Customers.CustomerId WHERE Customers.CustomerId- 1

    FOR XML AUTO

  6. SELECT Name, Country, Orderld, OrderDate, Amount

    FROM Orders INNER JOIN Customers ON Orders.CustomerId=Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML AUTO, ELEMENTS

  7. SELECT Name AS #39;@Name#39;, Country AS #39;@Country#39;, OrderId, OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId WHERE Customers.CustomerId= 1

    FOR XML PATH (#39;Customers#39;)

  8. SELECT Name AS #39;Customers/Name#39;, Country AS #39;Customers/Country#39;, OrderId,OrderDate, Amount FROM Orders INNER JOIN Customers ON Orders.CustomerId= Customers.CustomerId

WHERE Customers.CustomerId= 1 FOR XML PATH (#39;Customers#39;)

Correct Answer: A

Explanation:

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

Get Full Version of 70-461 Dumps