70-465 · Question #167
You have a database that contains a table named Customers. You need to retrieve a set of customers by using multiple nested SELECT statements. The solution must meet the following requirements…
The correct answer is B. A view. To retrieve a reusable set of customers that can be directly referenced in a FROM statement for nested SELECT queries, a view is the appropriate solution.
Question
Options
- AA CLR stored procedure
- BA view
- CAn unsigned store procedure
- DA scalar function
How the community answered
(46 responses)- A2% (1)
- B87% (40)
- C4% (2)
- D7% (3)
Why each option
To retrieve a reusable set of customers that can be directly referenced in a FROM statement for nested SELECT queries, a view is the appropriate solution.
A CLR stored procedure executes custom code and returns a result set, but it cannot be directly used in a FROM clause as a table-like object for nested queries.
A view is a virtual table whose content is defined by a query, allowing it to encapsulate complex queries. This virtual table can then be referenced directly in the FROM clause of other SELECT statements, fulfilling both the requirement for reusability and the ability to be used in a FROM clause.
An 'unsigned stored procedure' is not a standard SQL Server construct; regular stored procedures, like CLR ones, are primarily for execution and do not directly satisfy the requirement of being usable in a FROM clause as a reusable table for nested SELECTs.
A scalar function returns a single atomic value, not a 'set of customers' (a table) which is required for use in a FROM statement for nested SELECTs.
Concept tested: SQL Server Views for data abstraction and reusability
Source: https://learn.microsoft.com/en-us/sql/relational-databases/views/views?view=sql-server-ver16
Topics
Community Discussion
No community discussion yet for this question.