
Ultimate access to all questions.
A data engineer needs to create a table in Databricks using data from a CSV file at location /path/to/csv.
They run the following command:
CREATE TABLE new_table
______
OPTIONS (
header = "true",
delimiter = "|"
)
LOCATION "path/to/csv"
CREATE TABLE new_table
______
OPTIONS (
header = "true",
delimiter = "|"
)
LOCATION "path/to/csv"
Which of the following lines of code fills in the above blank to successfully complete the task?
A
FROM "path/to/csv"
B
USING CSV
C
FROM CSV
D
USING DELTA
Explanation:
In Databricks SQL, when creating a table from external data sources like CSV files, the correct syntax is USING CSV to specify the data source format.
USING CSV is the correct clause to specify that the table should be created using CSV formatOPTIONS clause then provides additional configuration for the CSV file (header=true, delimiter="|")LOCATION clause specifies the path to the CSV fileFROM "path/to/csv" is incorrect because FROM is used in SELECT queries, not in CREATE TABLE statementsFROM CSV is incorrect syntax for CREATE TABLEUSING DELTA would create a Delta table, not read from a CSV fileCREATE TABLE new_table
USING CSV
OPTIONS (
header = "true",
delimiter = "|"
)
LOCATION "path/to/csv"
CREATE TABLE new_table
USING CSV
OPTIONS (
header = "true",
delimiter = "|"
)
LOCATION "path/to/csv"
This creates an external table that references the CSV file at the specified location with the given options.