
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:
The correct answer is B. USING CSV.
Explanation:
In Databricks SQL, when creating an external table from a CSV file, 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 why the other options are incorrect:
FROM clause is used in SELECT statements, not in CREATE TABLE statements for specifying data source format.FROM clause is not used in this context, and the location is already specified in the LOCATION clause.The USING CSV clause tells Databricks that the table should be created from a CSV file format, and the OPTIONS clause allows you to specify CSV-specific options like header and delimiter.