Databricks Data Engineer Associate Question 256
Single answerA data engineer is tasked with creating a managed table in Databricks to store customer transaction data. The table should automatically manage the storage location and metadata. Which of the following SQL commands correctly creates a managed table in Databricks?
- A
CREATE TABLE customer_transactions (id INT, amount DOUBLE) USING PARQUET
- B
CREATE TABLE customer_transactions (id INT, amount DOUBLE) LOCATION '/mnt/data/transactions/'
- C
CREATE EXTERNAL TABLE customer_transactions (id INT, amount DOUBLE) USING DELTA LOCATION '/mnt/data/transactions/'
- D
CREATE TABLE customer_transactions (id INT, amount DOUBLE) OPTIONS ('path' '/mnt/data/transactions/')
Show answer and explanation
Correct answer: A
Explanation
Managed tables in Databricks are created using the CREATE TABLE command without specifying an external location. Databricks automatically handles the storage and metadata for managed tables. Including a LOCATION or OPTIONS('path' ...) parameter creates an external table, where the user is responsible for managing the underlying storage.
- A. Correct.
This is correct. In Databricks, using the
CREATE TABLEstatement without specifying an external location or options creates a managed table where Databricks manages both the metadata and data storage. - B. Incorrect.
This is incorrect because specifying a
LOCATIONin theCREATE TABLEcommand creates an external table, not a managed table. - C. Incorrect.
This is incorrect because the
CREATE EXTERNAL TABLEsyntax explicitly creates an external table, not a managed table. - D. Incorrect.
This is incorrect because specifying the
OPTIONS('path' ...)parameter indicates an external path, which makes the table an external table rather than a managed table.