A data scientist is exploring customer purchase data in Snowflake to identify high-value customer segments. They have a table named 'CUSTOMER TRANSACTIONS with columns 'CUSTOMER ID', 'TRANSACTION_DATE', and 'PURCHASE_AMOUNT'. They want to calculate the interquartile range (IQR) of 'PURCHASE AMOUNT for each customer. Which SQL query using Snowsight is the most efficient and accurate way to calculate and display the IQR for each 'CUSTOMER ID?

Correct Answer: E
Option E, using 'QUANTILE, is the most accurate way to calculate the IQR. 4)' returns an array representing the quartiles (0%, 25%, 50%, 75%, 100%). Subtracting the 25th percentile (index 1) from the 75th percentile (index 3) gives the IQR. Other options either approximate the percentiles (APPROX_PERCENTILE), calculate the range (MAX-MIN), or calculate standard deviation, none of which directly give the IQR. Option B while syntactically valid is less performant and returns the IQR on entire table not grouped by customer.