Databricks Data Engineer Associate Question 255
Single answerYou are working on a Databricks workspace and need to create a managed table named 'sales_data' in the database 'sales_db'. Which of the following commands correctly creates the managed table?
- A
CREATE TABLE sales_db.sales_data (id INT, amount DOUBLE, date DATE)
- B
CREATE TABLE sales_db.sales_data USING DELTA LOCATION '/mnt/data/sales_data'
- C
CREATE TABLE sales_db.sales_data OPTIONS ('path' '/mnt/data/sales_data')
- D
CREATE TABLE sales_data (id INT, amount DOUBLE, date DATE) LOCATION '/mnt/data/sales_data'
Show answer and explanation
Correct answer: A
Explanation
Managed tables in Databricks are fully managed by the platform, meaning both the metadata and data are stored in Databricks-managed storage. The correct command to create a managed table does not include an external location or path, as Databricks handles the storage internally.
- A. Correct.
This is the correct syntax to create a managed table in Databricks. Managed tables do not use an external location, and their data is stored in the Databricks-managed storage.
- B. Incorrect.
This creates an external table because the 'USING DELTA LOCATION' clause specifies an external storage location.
- C. Incorrect.
This syntax is invalid because the OPTIONS clause is not used for creating managed tables. It is typically used for external tables or when specifying additional options.
- D. Incorrect.
This creates an external table because the 'LOCATION' clause points to an external storage location, which makes the table unmanaged.