DATABRICKS-DATA-ENGINEER-ASSOCIATE practice question 18 of 25
A data engineer is attempting to drop a Spark SQL table my_table. The data engineer wants to delete all table metadata and data. They run the following command: DROP TABLE IF EXISTS my_table While the object no longer appears when they run SHOW TABLES, the data files still exist. Which of the following describes why the data files still exist and the metadata files were deleted?
Full set: 177 questionsThe behavior described, where dropping a table removes its metadata but leaves the underlying data files intact, is the defining characteristic of an external (or unmanaged) table. Databricks assumes that data in an external location is managed outside of the table definition. Therefore, the DROP TABLE command for an external table only removes the table's metadata from the metastore, preserving the data files in their specified location for other processes or table definitions to use.
A. The table’s data was larger than 10 GB: The size of the data does not influence whether the underlying files are deleted when a table is dropped.
B. The table’s data was smaller than 10 GB: Similar to option A, data size is irrelevant to the DROP TABLE command's behavior regarding data file deletion.
D. The table did not have a location: All Spark SQL tables, whether managed or external, must have a location where their data files are stored.
E. The table was managed: If the table were managed, Databricks would manage both its metadata and its data. Consequently, running DROP TABLE would have deleted both the metadata and the underlying data files.
1. Databricks SQL Language Reference
DROP TABLE:
Section: DROP TABLE
Content: "For an external table
only the metadata information is removed from the metastore. The data in the external location is not touched." This directly confirms that dropping an external table leaves the data files.
Source: Databricks Documentation > SQL reference > Data definition language > DROP TABLE.
2. Databricks Documentation
"What are tables on Databricks?":
Section: "Managed table" and "External table"
Content: The documentation explicitly contrasts the two types. For managed tables: "When you drop a managed table
you also delete the underlying data." For external tables: "When you drop an external table
you do not delete the underlying data." This clearly explains the difference in behavior described in the question.
Source: Databricks Documentation > Data management > Data objects in the Databricks Lakehouse > What are tables on Databricks?.
Keep practicing
Take the free DATABRICKS-DATA-ENGINEER-ASSOCIATE practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other DATABRICKS-DATA-ENGINEER-ASSOCIATE practice questions
- Question 1In which of the following scenarios should a data engineer use the MERGE INTO command ins…
- Question 2Which of the following data workloads will utilize a Gold table as its source?
- Question 3A data engineer has developed a data pipeline to ingest data from a JSON source using Aut…
- Question 4Which two components function in the DB platform architecture’s control plane? (Choose tw…
- Question 5Which of the following code blocks will remove the rows where the value in column age is …
- Question 7Which of the following statements regarding the relationship between Silver tables and Br…
