Microsoft Azure Data Fundamentals — Question 58

You have a SQL query that combines customer data and order data. The query includes calculated columns.
You need to create a database object that would allow other users to rerun the same SQL query.
What should you create?

Answer options

Correct answer: B

Explanation

The correct answer is B, a view, as it allows users to execute a predefined SQL query with the included calculated columns without modifying the underlying tables. An index (A) improves query performance but does not encapsulate a query. A scalar function (C) returns a single value and is not suitable for encapsulating a query. A table (D) stores data but does not provide the same functionality as a view for rerunning queries.