Developing Microsoft SQL Server Databases — Question 22

You have a Microsoft SQL Azure database named DBAzurel. DBAzurel contains a table named Orders that stores sales data.
Each order has a sales total that can only be discovered by querying multiple tables.
You need to ensure that the value of the sales total is returned by executing a query on Orders.
What should you create?

Answer options

Correct answer: C

Explanation

The correct choice is C, as a calculated column that utilizes a table-valued function can directly compute the sales total from multiple tables when queried. Option A is incorrect because a scalar function cannot return a total from multiple tables, and option B does not produce a value in the table itself. Option D is not suitable as a ranking function does not calculate totals.