nerdexam
SnowflakeSnowflake

SOL-C01 · Question #175

SOL-C01 Question #175: Real Exam Question with Answer & Explanation

The correct answer is B: Use a transformation within the `COPY INTO' statement to replace null values with 0.. Using a transformation within the 'COPY INTO' statement (option B) allows you to directly handle missing values during the data loading process, providing the most efficient solution. You can utilize a 'CASE' statement or similar logic within the column mapping of the 'COPY INTO'

Data Loading and Unloading

Question

A Snowflake table 'product catalog' exists with columns 'product id', 'product_name', and 'price'. You have a pipe-delimited file in an external stage named 's3 stage' containing product data, but some rows have missing values for the 'price' column. You want to load the data, replacing missing prices with a default value of 0. Which approach is the MOST appropriate to handle missing values during the 'COPY INTO' operation?

Options

  • AModify the file format options to automatically replace null values with 0.
  • BUse a transformation within the `COPY INTO' statement to replace null values with 0.
  • CLoad the data into a staging table, then use a SQL 'UPDATE statement to replace null prices with
  • DUse the 'ON_ERROR = SKIP_FILE' option to skip any file with missing prices.
  • EThe 'COPY INTO' command cannot handle missing values; pre-processing is always required.

Explanation

Using a transformation within the 'COPY INTO' statement (option B) allows you to directly handle missing values during the data loading process, providing the most efficient solution. You can utilize a 'CASE' statement or similar logic within the column mapping of the 'COPY INTO' statement to replace nulls with the default value of 0. Option A is not valid. Option C requires additional steps. Option D skips over valuable data, and Option E is false because of the transformation support.

Topics

#COPY INTO#Data Loading#Transformations#NULL Handling

Community Discussion

No community discussion yet for this question.

Full SOL-C01 PracticeBrowse All SOL-C01 Questions