Download Querying Microsoft SQL Server 2012-2014.70-461.PracticeTest.2018-10-11.124q.vcex

Vendor: Microsoft
Exam Code: 70-461
Exam Name: Querying Microsoft SQL Server 2012/2014
Date: Oct 11, 2018
File Size: 9 MB

How to open VCEX files?

Files with VCEX extension can be opened by ProfExam Simulator.

Demo Questions

Question 1
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? 
SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount
  1. FROM ( 
        SELECT SalesOrderId, SalesAmount 
        FROM DomesticSalesOrders 
        UNION ALL 
        SELECT SalesOrderId, SalesAmount 
        FROM InternationalSalesOrders 
      ) AS p 
    SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount
  2. FROM ( 
        SELECT SalesOrderId, SalesAmount 
        FROM DomesticSalesOrders 
        UNION 
        SELECT SalesOrderId, SalesAmount 
        FROM InternationalSalesOrders 
      ) AS p 
    SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount
  3. FROM DomesticSalesOrders 
      UNION 
      SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount 
      FROM InternationalSalesOrders 
    SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount
  4. FROM DomesticSalesOrders 
      UNION ALL 
      SELECT COUNT(*) AS NumberOfSales, SUM(SalesAmount) AS TotalSalesAmount 
      FROM InternationalSalesOrders
Correct answer: A
Explanation:
Reference: http://msdn.microsoft.com/en-us/library/ms180026.aspxReference: http://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs-union-all-optimalperformance-comparison/
Reference: http://msdn.microsoft.com/en-us/library/ms180026.aspx
Reference: http://blog.sqlauthority.com/2009/03/11/sql-server-difference-between-union-vs-union-all-optimalperformance-comparison/
Question 2
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:
Reference: http://technet.microsoft.com/en-us/library/bb510663.aspxReference: http://technet.microsoft.com/en-us/library/ms174361.aspxReference: http://msdn.microsoft.com/en-us/library/ms187926.aspxReference: http://technet.microsoft.com/en-us/library/ms190357.aspxReference: http://technet.microsoft.com/en-us/library/ms188061.aspx
Reference: http://technet.microsoft.com/en-us/library/bb510663.aspx
Reference: http://technet.microsoft.com/en-us/library/ms174361.aspx
Reference: http://msdn.microsoft.com/en-us/library/ms187926.aspx
Reference: http://technet.microsoft.com/en-us/library/ms190357.aspx
Reference: http://technet.microsoft.com/en-us/library/ms188061.aspx
Question 3
You use a Microsoft SQL Server 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:
Reference: http://msdn.microsoft.com/en-us/library/gg471497.aspxReference: http://msdn.microsoft.com/en-us/library/ff929144.aspx
Reference: http://msdn.microsoft.com/en-us/library/gg471497.aspx
Reference: http://msdn.microsoft.com/en-us/library/ff929144.aspx
Question 4
You administer a Microsoft SQL Server 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_CustomerID 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:
Reference: http://msdn.microsoft.com/en-us/library/ms188388.aspx
Reference: http://msdn.microsoft.com/en-us/library/ms188388.aspx
Question 5
You develop a Microsoft SQL Server 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' 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?
  1. views
  2. table partitions
  3. table-valued functions
  4. stored procedures
Correct answer: A
Question 6
You develop a Microsoft SQL Server 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 7
You develop a Microsoft SQL Server 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
    @CustomerID 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,
    @CustomerRatingByCustomer
  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 @CustomerRatingByCustomer 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 CustomerID = @CustomerID
    RETURNS @Result
    GO
Correct answer: AE
Question 8
You develop a Microsoft SQL Server database that contains a heap named OrdersHistorical. 
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:
Reference: http://technet.microsoft.com/en-us/library/ms189857.aspxReference: http://msdn.microsoft.com/en-us/library/ms187373.aspx
Reference: http://technet.microsoft.com/en-us/library/ms189857.aspx
Reference: http://msdn.microsoft.com/en-us/library/ms187373.aspx
Question 9
You use a Microsoft SQL Server database that contains two tables named SalesOrderHeader and SalesOrderDetail. The indexes on the tables are as shown in the exhibit. (Click the Exhibit button.) 
  
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 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 FORCESEEKhint in the query.
  4. Update statistics on SalesOrderId on both tables.
Correct answer: D
Explanation:
References: http://msdn.microsoft.com/en-us/library/ms187348.aspx
References: http://msdn.microsoft.com/en-us/library/ms187348.aspx
Question 10
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 >= CONVERT(DATE, GETDATE())
    AND PurchaseTime < DATEADD(DAY, 1, CONVERT(DATE, GETDATE()))
Correct answer: D
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. http://technet.microsoft.com/en-us/library/ms181034.aspx
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. 
http://technet.microsoft.com/en-us/library/ms181034.aspx
HOW TO OPEN VCE FILES

Use VCE Exam Simulator to open VCE files
Avanaset

HOW TO OPEN VCEX AND EXAM FILES

Use ProfExam Simulator to open VCEX and EXAM files
ProfExam Screen

ProfExam
ProfExam at a 20% markdown

You have the opportunity to purchase ProfExam at a 20% reduced price

Get Now!