
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
None of these lines of code are needed to successfully complete the task
B
USING CSV
C
FROM CSV
D
USING DELTA
E
FROM "path/to/csv"
Explanation:
In Databricks SQL, when creating a table from a CSV file using the CREATE TABLE statement, you need to specify the data source format using the USING clause. The correct syntax is:
CREATE TABLE table_name
USING CSV
OPTIONS (
header = "true",
delimiter = "|"
)
LOCATION "path/to/csv"
CREATE TABLE table_name
USING CSV
OPTIONS (
header = "true",
delimiter = "|"
)
LOCATION "path/to/csv"
Let's analyze each option:
USING clause is required to specify the data source format.USING, not FROM.LOCATION clause already specifies the path; using FROM here would be syntactically incorrect.Key Points:
USING clause specifies the data source format (CSV, JSON, PARQUET, DELTA, etc.)OPTIONS clause provides format-specific options like header, delimiter, etc.LOCATION clause specifies where the data files are stored.