nerdexam
SnowflakeSnowflake

SOL-C01 · Question #4

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

The correct answer is A: Option A. Options A and D are correct. Option A uses double quotes to safely enclose the table name within the CREATE TABLE statement. This is the standard way to handle identifiers with spaces or special characters in SQL. Option D provides a Snowpark DataFrame-centric approach that autom

Querying and Performance

Question

You're writing a Snowflake Notebook that needs to dynamically create tables based on a list of table names stored in a Python list called 'table_names'. You want to iterate through this list and execute a CREATE TABLE statement for each table name. However, the names might include spaces and special characters. Which approach or approaches can you use to achieve this goal safely and effectively?

Options

  • AOption A
  • BOption B
  • COption C
  • DOption D
  • EOption E

Explanation

Options A and D are correct. Option A uses double quotes to safely enclose the table name within the CREATE TABLE statement. This is the standard way to handle identifiers with spaces or special characters in SQL. Option D provides a Snowpark DataFrame-centric approach that automatically handles identifier quoting when creating the table using `saveAsTable' . Option B modifies the table names by replacing spaces. Option C's reliance on shell escaping ('shlex.quote') is not relevant or necessary when executing SQL within a Snowpark session. Option E is unsafe as it does not handle the case where table names have spaces or other special characters and will result in SQL errors.

Topics

#Dynamic SQL#Snowflake Notebooks#Identifier Quoting#CREATE TABLE

Community Discussion

No community discussion yet for this question.

Full SOL-C01 PracticeBrowse All SOL-C01 Questions