Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the purpose of the COPY INTO command in Snowflake?
The COPY INTO command loads data from files in external or internal stages into Snowflake tables. It helps move data efficiently into the database.
Click to reveal answer
beginner
Which file formats can COPY INTO handle in Snowflake?
It supports common formats like CSV, JSON, Parquet, Avro, and ORC files for loading data.
Click to reveal answer
beginner
What is a 'stage' in the context of the COPY INTO command?
A stage is a location where data files are stored before loading. It can be internal (inside Snowflake) or external (like AWS S3, Azure Blob Storage).
Click to reveal answer
intermediate
How does Snowflake handle errors during a COPY INTO operation?
You can specify options like ON_ERROR to control behavior: skip errors, continue loading, or abort the operation.
Click to reveal answer
beginner
What does the FILE_FORMAT option do in the COPY INTO command?
It tells Snowflake how to interpret the data files by specifying the format type and related settings like delimiter or compression.
Click to reveal answer
What does the COPY INTO command do in Snowflake?
AExports data from tables to files
BLoads data from files into tables
CDeletes data from tables
DCreates new tables
✗ Incorrect
The COPY INTO command loads data from files into Snowflake tables.
Where can the source files be located for the COPY INTO command?
AOnly internal Snowflake stages
BOnly external cloud storage
CInternal or external stages
DOnly local computer
✗ Incorrect
Files can be in internal or external stages like S3 or Azure Blob Storage.
Which option controls how errors are handled during COPY INTO?
AON_ERROR
BFILE_FORMAT
CSTAGE_LOCATION
DDATA_RETENTION_TIME
✗ Incorrect
ON_ERROR specifies what to do if errors occur during loading.
What does the FILE_FORMAT option specify?
AHow to read the input files
BThe cloud provider
CThe destination table
DThe user permissions
✗ Incorrect
FILE_FORMAT tells Snowflake how to interpret the data files.
Which of these is NOT a supported file format for COPY INTO?
ACSV
BJSON
CParquet
DExcel XLSX
✗ Incorrect
Snowflake does not natively support Excel XLSX files for COPY INTO.
Explain how the COPY INTO command works in Snowflake and what key options you can use.
Think about where files come from, how Snowflake reads them, and what happens if errors occur.
You got /4 concepts.
Describe the difference between internal and external stages in the context of the COPY INTO command.
Consider where your data files live before loading.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of the COPY INTO command in Snowflake?
easy
A. To load data files from cloud storage into Snowflake tables
B. To export data from Snowflake tables to local files
C. To create new tables in Snowflake
D. To delete data from Snowflake tables
Solution
Step 1: Understand the command purpose
The COPY INTO command is designed to load data from external files into Snowflake tables.
Step 2: Compare options
Options B, C, and D describe exporting, creating, or deleting data, which are not the function of COPY INTO.
Final Answer:
To load data files from cloud storage into Snowflake tables -> Option A
Quick Check:
Loading data = COPY INTO [OK]
Hint: COPY INTO means loading data into tables [OK]
Common Mistakes:
Confusing COPY INTO with export commands
Thinking COPY INTO creates tables
Assuming COPY INTO deletes data
2. Which of the following is the correct basic syntax to load data using COPY INTO in Snowflake?
easy
A. COPY table_name INTO @stage_name FILE_FORMAT = (TYPE = 'CSV');
B. LOAD DATA INTO table_name FROM @stage_name FORMAT = CSV;
C. COPY INTO table_name FROM @stage_name FILE_FORMAT = (TYPE = 'CSV');
D. INSERT INTO table_name COPY FROM @stage_name FILE_FORMAT = CSV;
Solution
Step 1: Recall correct COPY INTO syntax
The correct syntax is COPY INTO table_name FROM @stage_name FILE_FORMAT = (TYPE = 'CSV'); to load CSV files from a stage.
Step 2: Identify incorrect syntax
Options A, C, and D use wrong keywords or order that Snowflake does not accept.
Final Answer:
COPY INTO table_name FROM @stage_name FILE_FORMAT = (TYPE = 'CSV'); -> Option C
Quick Check:
Correct COPY INTO syntax = COPY INTO table_name FROM @stage_name FILE_FORMAT = (TYPE = 'CSV'); [OK]
Hint: COPY INTO table FROM stage with FILE_FORMAT [OK]
Common Mistakes:
Swapping INTO and FROM keywords
Using LOAD DATA instead of COPY INTO
Incorrect FILE_FORMAT syntax
3. Given the command:
COPY INTO my_table FROM @my_stage FILE_FORMAT = (TYPE = 'CSV' FIELD_DELIMITER = ',') ON_ERROR = 'skip_file';
What happens if one file in the stage has errors during loading?
medium
A. Snowflake retries loading the file indefinitely
B. The entire load fails and no data is loaded
C. Only the erroneous rows are skipped, file loads partially
D. The file with errors is skipped, other files load successfully
Solution
Step 1: Understand ON_ERROR = 'skip_file'
This option tells Snowflake to skip any file that causes errors during loading instead of failing the entire load.
Step 2: Analyze the effect on other files
Other files without errors will load normally, so only the bad file is skipped.
Final Answer:
The file with errors is skipped, other files load successfully -> Option D
Quick Check:
ON_ERROR = skip_file skips bad files [OK]
Hint: ON_ERROR = skip_file skips bad files, loads others [OK]
Common Mistakes:
Assuming entire load fails on one bad file
Thinking only bad rows are skipped with skip_file
Believing Snowflake retries endlessly
4. You run this command:
COPY INTO sales FROM @data_stage FILE_FORMAT = (FORMAT_NAME = 'csv_format');
But get an error: SQL compilation error: file format not found. What is the likely cause?
medium
A. The stage @data_stage does not exist
B. The FILE_FORMAT clause references a named file format that does not exist
C. The sales table does not exist
D. The CSV files are empty
Solution
Step 1: Analyze the error message
The error says file format not found, meaning Snowflake expects a named file format or a full definition.
Step 2: Check the FILE_FORMAT clause
The clause FILE_FORMAT = (FORMAT_NAME = 'csv_format') references a named file format that does not exist.
Final Answer:
The FILE_FORMAT clause references a named file format that does not exist -> Option B
Quick Check:
File format error means missing or wrong FILE_FORMAT [OK]
Hint: File format errors mean missing or wrong FILE_FORMAT [OK]
Common Mistakes:
Assuming stage or table missing causes file format error
Ignoring need for file format definition
Thinking empty files cause this error
5. You want to load JSON files from an external S3 bucket into a Snowflake table named events. Which COPY INTO command correctly handles JSON format and ignores files with errors?
hard
A. COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'JSON') ON_ERROR = 'skip_file';
B. COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') ON_ERROR = 'continue';
C. COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'JSON') ON_ERROR = 'abort_statement';
D. COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'XML') ON_ERROR = 'skip_file';
Solution
Step 1: Match file format to JSON files
Since files are JSON, the FILE_FORMAT must specify TYPE = 'JSON'.
Step 2: Choose error handling to ignore bad files
ON_ERROR = 'skip_file' skips files with errors, which matches the requirement.
Step 3: Eliminate incorrect options
COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'CSV') ON_ERROR = 'continue'; uses CSV format, wrong for JSON. COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'JSON') ON_ERROR = 'abort_statement'; aborts on error, not ignoring. COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'XML') ON_ERROR = 'skip_file'; uses XML format, incorrect.
Final Answer:
COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'JSON') ON_ERROR = 'skip_file'; -> Option A
Quick Check:
JSON format + skip_file error handling = COPY INTO events FROM @s3_stage FILE_FORMAT = (TYPE = 'JSON') ON_ERROR = 'skip_file'; [OK]
Hint: Match FILE_FORMAT type to file type and use skip_file to ignore errors [OK]