Valid SOL-C01 Dumps shared by ExamDiscuss.com for Helping Passing SOL-C01 Exam! ExamDiscuss.com now offer the newest SOL-C01 exam dumps, the ExamDiscuss.com SOL-C01 exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com SOL-C01 dumps with Test Engine here:
A data warehouse contains a table 'orders' with columns 'order_id', 'customer_id', 'order_date' , and 'order_details' (VARIANT type containing nested JSON). You need to create a new table 'customer_orders' that aggregates the total order value per customer for orders placed in the year 2023. The order value is calculated as the sum of the 'price' field for each item in the 'items' array within the 'order_detailS JSON. Which of the following SQL statements achieves this with optimal performance, assuming a large dataset and leveraging best practices for querying VARIANT data?
Correct Answer: D
Option D provides the most optimized and correct solution. Using 'CROSS APPLY FLATTEN' (or `LATERAL FLATTEN' which is equivalent) efficiently un-nests the `items' array. Filtering by = 2023' before the 'FLATTEN' operation can significantly improve performance by reducing the number of rows processed by the FLATTEN' function. Option A is syntactically correct, however CROSS APPLY is preferrable to use for readability. Option B is incorrect. It attempts to use array slicing syntax which is not valid for summing the prices of all items within the array. Option C is incorrect. The is unnecessary as the 'item' is already a JSON object. The correct syntax is 'item.value' when using Option E is invalid syntax. The FLATTEN function is not valid inside SUM.