MCSA Querying Microsoft SQL Server 2012/2014

Here you have the best Microsoft 70-461 practice exam questions

  • You have 68 total questions to study from
  • Each page has 5 questions, making a total of 14 pages
  • You can navigate through the pages using the buttons at the bottom
  • This questions were last updated on November 17, 2024
Question 1 of 68

You develop a Microsoft SQL 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?

    Correct Answer: A

    The correct Transact-SQL statement for creating a computed column that returns the sum total of the ItemsInStore and ItemsInWarehouse values is 'ALTER TABLE Inventory ADD TotalItems AS ItemsInStore + ItemsInWarehouse'. This syntax correctly defines a computed column named TotalItems that calculates the sum of ItemsInStore and ItemsInWarehouse for each row in the Inventory table.

Question 2 of 68

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

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

    Correct Answer: D

    To improve the performance of a view by persisting data to disk in SQL Server, you should create an indexed view. Creating a clustered index on the view materializes the view's data and stores it on disk, which can significantly improve performance especially for complex queries. This is done by creating a clustered index on the view. Other options like triggers (INSTEAD OF or AFTER) or using WITH VIEW_METADATA do not serve the purpose of persisting data to disk.

Question 3 of 68

Note: This question is part of a series of questions that use the same set of answer choices. An answer choice may be correct for more than one question in the series.

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?

    Correct Answer: I

    To store both date and time along with time zone information, the DATETIMEOFFSET data type is appropriate. It includes the date, time, and the time zone offset, which allows the database to store the complete datetime value including time zone information. This aligns with the requirements of handling departure and arrival times in a travel application that operates across multiple time zones.

Question 4 of 68

You have a Microsoft SQL Server 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?

    Correct Answer: D

    To achieve the requirements of returning the CustomerName for all customers and the OrderDate for any orders that they have placed, and ensuring that the results include customers who have not placed any orders, you need to use a LEFT OUTER JOIN. This join will return all records from the Customers table and the matched records from the Orders table. If there's no match, the result is still a row in the result with NULL in place of the Orders table columns. Therefore, the correct query is: SELECT CustomerName, OrderDate FROM Customers LEFT OUTER JOIN Orders ON Customers.CustomerID = Orders.CustomerID.

Question 5 of 68

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?

    Correct Answer: A

    To achieve the minimum possible execution time for aggregating data from two tables with more than 100 million rows each, it is optimal to use the UNION ALL clause. UNION ALL combines the result sets of both SELECT queries including duplicates and is faster as it doesn't require sorting and removing duplicates like UNION. By wrapping the combined results in a subquery and then performing the COUNT and SUM operations, it efficiently returns the required aggregate information. Option A uses UNION ALL correctly, making it the best choice.