
Answer-first summary for fast verification
Answer: USING CSV
## Explanation The correct answer is **B. USING CSV**. ### Why this is correct: 1. In Databricks SQL, when creating a table from a data source like CSV, you need to specify the data source format using the `USING` clause. 2. The syntax is: `CREATE TABLE table_name USING format OPTIONS (...) LOCATION "path"` 3. For CSV files, the format should be `CSV`, so `USING CSV` is the correct syntax. ### Why other options are incorrect: - **A. None of these lines of code are needed**: Incorrect because the `USING` clause is required to specify the data source format. - **C. FROM CSV**: Incorrect syntax - Databricks uses `USING` not `FROM` for specifying data source format in CREATE TABLE statements. - **D. USING DELTA**: Incorrect because this would create a Delta table, not read from a CSV file. - **E. FROM "path/to/csv"**: Incorrect syntax - the path is already specified in the `LOCATION` clause. ### Complete correct syntax: ```sql CREATE TABLE new_table USING CSV OPTIONS ( header = "true", delimiter = "|" ) LOCATION "path/to/csv" ``` This syntax creates an external table that reads data from the CSV file at the specified location with the given options (header=true and pipe delimiter).
Author: Keng Suppaseth
Ultimate access to all questions.
No comments yet.
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"