You have a table in Snowflake named 'CUSTOMER DATA' with columns 'CUSTOMER D', 'PURCHASE AMOUNT', and 'RECENCY'. You want to perform feature scaling on 'PURCHASE AMOUNT' using Min-Max scaling and store the scaled values in a new column named 'SCALED PURCHASE _ AMOUNT'. Which of the following Snowflake SQL code snippets correctly implements this feature scaling? Note: Assume there are no NULL values in PURCHASE AMOUNT and you have privileges to create temporary tables and UDFs if necessary.

Correct Answer: D
Option D is correct because it calculates the min and max purchase amounts from the CUSTOMER_DATA table and stores them in a temporary table It then adds a new column to the CUSTOMER_DATA table and updates this column with the Min-Max scaled values, properly joining the temporary table to access the min and max values during the update. Option A is syntactically correct but executes multiple subqueries within the UPDATE statement, which can be less efficient than joining with a temporary table. Option B is syntactically incorrect as aggregate functions (MIN, MAX) cannot be used directly in the UPDATE statement without a GROUP BY clause. Option C does not work as MIN_VAL and MAX VAL are column aliases that cannot be directly referenced as variables within the UPDATE statement. Option E is syntactically correct, but assumes that MIN VAL and MAX VAL variables are directly available during update, which is not how Snowflake SQL works.