
Ultimate access to all questions.
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?
A
The table's data was larger than 10 GB
B
The table's data was smaller than 10 GB
C
The table was external
D
The table did not have a location
E
The table was managed
Explanation:
In Databricks/Spark SQL, there are two types of tables:
Managed Tables (Internal Tables):
DROP TABLE, both the metadata (table definition) AND the underlying data files are deleted.External Tables:
DROP TABLE, only the metadata (table definition) is deleted.In this scenario:
SHOW TABLES → metadata was deleted ✓This behavior matches exactly what happens with external tables. The DROP TABLE command for external tables only removes the table definition from the metastore, leaving the actual data files untouched.
Why the other options are incorrect:
Key takeaway: Always be aware of whether you're working with managed or external tables, as dropping them has different consequences for data persistence.