
Answer-first summary for fast verification
Answer: TRANSFORM
The correct function is `TRANSFORM`, which is used to apply a specified function to each element in an array. In this scenario, it converts each Celsius temperature reading in the array to Fahrenheit. The syntax is `transform(expr, func)`, where `expr` is the array and `func` is the function to apply to each element.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
You are tasked with converting temperature readings from Celsius to Fahrenheit in an IoT dataset. Each device has 5 readings stored in an array. Complete the SQL query by selecting the appropriate function to apply the conversion to each element in the array.
Schema: deviceId INT, deviceTemp ARRAY
SELECT deviceId, __(deviceTempC, i -> (i * 9/5) + 32) as deviceTempF FROM sensors
A
APPLY
B
MULTIPLY
C
ARRAYEXPR
D
TRANSFORM
E
FORALL
No comments yet.