Every table that lives under Unity Catalog falls into one of two physical residency models.
- A managed table stores its files inside storage that the metastore owns and addresses on the user's behalf, so the catalog itself dictates the directory layout, file naming, retention sweep, and physical cleanup at drop time.
- An external table is a metadata pointer over files that already live in customer-owned object storage, attached to an external location that names a storage credential.
The data engineer sees both as ordinary three-level-named entities in SHOW TABLES, but every administrative operation differs in subtle ways that the exam likes to probe, and that production incidents punish when they are confused.
When to use
The choice usually starts with a question about ownership, not performance.
- Will the lakehouse fully own this dataset from creation to deletion, with no other tool reading its files directly? Pick managed.
- Or is the dataset already landing into a corporate data lake path that other tools (an external query engine, a partner connector, a downstream Hadoop reader) write to and read from? Pick external.
Managed tables can be moved between locations only by rewriting; external tables can be reattached to a different path by re-running CREATE TABLE against the same metadata target. The exam expects the candidate to make this call on first read of the scenario, so train the eye for the phrase "files already exist in" or "data is shared with another platform" as a hint toward external residency.
Predictive optimization is the second axis that pushes most new pipelines toward managed tables.
- Auto-compaction, predictive
OPTIMIZE, predictiveVACUUM, and statistics maintenance run automatically on managed tables once enabled at the catalog or schema level, and they no longer require manual maintenance schedules. - External tables historically required hand-written
OPTIMIZEandVACUUMjobs, and the platform now extends predictive optimization coverage to external Delta tables as well, but only where the metastore can prove sole writer ownership. - When another writer is suspected, the engine refuses to compact files behind its back to avoid corrupting concurrent writes from outside the lakehouse.
Defining a managed table
A managed table is created with a plain CREATE TABLE statement.
No LOCATION clause is given because the metastore picks the path under the schema's managed storage root.
The default storage root for a managed table is the schema's location, which in turn defaults to the catalog's managed storage location, which in turn defaults to the metastore's managed root.
Each level may override the inherited default by binding to a different external location at create time, which is what large organizations do to keep production catalogs in dedicated storage accounts.
USE CATALOG fin_lakehouse;
USE SCHEMA silver;
CREATE TABLE customers (
customer_id BIGINT,
email STRING,
full_name STRING,
signup_date DATE,
region STRING,
loyalty_tier STRING
)
USING DELTA
COMMENT 'Cleaned customer master, refreshed nightly by Lakeflow Jobs';
The metastore writes the files under a path it controls, records the path in its internal storage tables, and ties the table's lifecycle directly to the catalog entry. A user with MODIFY privilege can INSERT, UPDATE, DELETE, and MERGE, but cannot move the files to a different bucket without dropping and recreating the table.
A user with SELECT privilege reads through the engine, never by addressing the underlying path. Cluster code that tries dbutils.fs.ls() on the managed location is rejected by Unity Catalog because direct path access on managed table storage is forbidden by design.
Defining an external table
An external table is created with a LOCATION clause that points at a path under a Unity Catalog external location.
The external location, in turn, is bound to a storage credential that grants the workspace's service principal write access to that bucket or container.
Without an external location covering the path, the CREATE TABLE LOCATION call fails with a permission error even if the cluster identity has direct cloud IAM rights, because the metastore validates the path against its external location list, not the cluster's network identity.
CREATE TABLE bronze.raw_clickstream (
event_id STRING,
user_id BIGINT,
event_type STRING,
ts TIMESTAMP,
url STRING,
payload STRING
)
USING DELTA
LOCATION 'abfss://landing@finlakeprod.dfs.core.windows.net/clickstream/raw/'
COMMENT 'External Delta over partner-landed clickstream files';
The table now reads and writes from the bound path. DROP TABLE bronze.raw_clickstream removes the metadata entry but leaves the files untouched on the storage account. A second CREATE TABLE at the same path immediately resurrects the dataset by reading the existing _delta_log from the bucket, which is the standard recovery move when an external table is accidentally dropped.
Modifying tables
Modifications fall into two buckets: schema mutations and table property mutations. Both apply to managed and external tables identically. A column is:
- added with
ALTER TABLE ... ADD COLUMNS - dropped with
ALTER TABLE ... DROP COLUMN(which requiresdelta.columnMapping.mode = 'name'to be set) - renamed with
ALTER TABLE ... RENAME COLUMN - retyped with the upcast set the Delta protocol allows
Comments, properties, table tags, and clustering specs are altered through their own clauses. Constraints (NOT NULL, CHECK, PRIMARY KEY, FOREIGN KEY) are added and dropped with ALTER TABLE ... ADD CONSTRAINT and ALTER TABLE ... DROP CONSTRAINT.
External tables additionally support ALTER TABLE ... SET LOCATION to re-attach the table metadata to a different path. The new path must be empty of conflicting Delta logs or contain a fully compatible log of the same table identity, otherwise the operation fails. Managed tables cannot be relocated because their identity is defined by their storage path; the engine refuses to point a managed table at any other root.
ALTER TABLE silver.customers
ADD COLUMNS (preferred_language STRING COMMENT 'BCP-47 tag');
ALTER TABLE silver.customers
ALTER COLUMN loyalty_tier COMMENT 'gold|silver|bronze tier badge';
ALTER TABLE silver.customers
SET TBLPROPERTIES (
'delta.enableChangeDataFeed' = 'true',
'delta.columnMapping.mode' = 'name'
);
ALTER TABLE bronze.raw_clickstream
SET LOCATION 'abfss://landing@finlakeprod.dfs.core.windows.net/clickstream/raw_v2/';
💡 Exam Trap: A
RENAME COLUMNon a Delta table requires column mapping modename. If the table was created without the mode set, the rename fails with a protocol upgrade hint. The candidate is expected to recognize this error path and applySET TBLPROPERTIES ('delta.columnMapping.mode' = 'name')first, even though that property triggers a Delta minReader and minWriter version bump that some older readers cannot consume.
Deleting tables
DROP TABLE removes the metadata entry for both kinds of table.
The decisive difference shows up underneath.
For a managed table, Unity Catalog also deletes the underlying files synchronously at drop time, with a configurable retention window during which the data is recoverable through UNDROP TABLE from the schema's trash.
After the retention window passes (the default is seven days), the files are permanently purged and UNDROP no longer works.
For an external table, DROP TABLE only removes the metadata entry; the underlying files are not touched, and UNDROP TABLE re-creates the metadata pointer at the same path.
DROP TABLE silver.customers;
SHOW TABLES DROPPED IN silver;
UNDROP TABLE silver.customers;
📊 Limit: Unity Catalog retains dropped managed tables for seven days by default. Beyond that window the files are permanently deleted and
UNDROP TABLEreturns an error. External table drops are recoverable at any time as long as the underlying path still holds the Delta log.
⚠️ Anti-Pattern: Treating
DROP TABLEon a production managed table as a soft action becauseUNDROPexists. ADROP TABLEon a managed table is destructive within seven days and irreversible after. Production schemas should grantMODIFYandOWNERSHIPonly to service principals that run vetted Lakeflow Jobs, andDROPshould never be in an ad-hoc analyst's session privilege set.
Converting between managed and external
Converting an existing path-based Delta table into a Unity Catalog managed entry is a one-way procedure.
The simplest path is CREATE TABLE ... AS SELECT * FROM delta.\abfss://.../path`` which copies the data into a new managed location. This rewrites the files, paying the I/O cost once but producing a fully managed table that predictive optimization will then maintain.
The platform also supports an in-place upgrade for tables that meet residency rules. A path-registered hive_metastore table can be moved into Unity Catalog with CREATE TABLE ... LIKE COPY LOCATION patterns or the SYNC SCHEMA workflow. Converting from external to managed without data movement requires the path to already sit under the schema's managed storage root, which is rare in production.
The reverse conversion (managed to external) is not a single SQL command. The recommended pattern is:
CREATE TABLE external_copy LIKE managed_table LOCATION 'abfss://...'INSERT INTO external_copy SELECT * FROM managed_tableDROP TABLE managed_tableALTER TABLE external_copy RENAME TO managed_table_name
This rewrites files into the external location and replaces the metadata entry. A DEEP CLONE accomplishes the file copy as well, with the bonus of preserving Delta history.
-- Managed copy of an existing external table
CREATE OR REPLACE TABLE silver.customers
DEEP CLONE delta.`abfss://staging@finlakeprod.dfs.core.windows.net/customers/`;
-- External copy of an existing managed table
CREATE TABLE silver.customers_external
LIKE silver.customers
LOCATION 'abfss://archive@finlakeprod.dfs.core.windows.net/customers/';
INSERT INTO silver.customers_external SELECT * FROM silver.customers;
Storage credentials, external locations, and the chain of trust
How it works
Every external table inherits its authorization story from a chain that begins at the storage credential and passes through the external location.
A storage credential is a securable that names a cloud-side identity (an Azure managed identity, an AWS IAM role, or a GCP service account) and grants Unity Catalog the right to assume it.
An external location is a securable that pairs a URL prefix with a storage credential and declares that any path under the prefix is governed by the credential.
A user is permitted to create an external table at a path only when they hold CREATE EXTERNAL TABLE on the covering external location, regardless of any direct cloud IAM grant they may also hold.
This two-step bind is what gives Unity Catalog its credential vaulting story. The user code never sees the underlying storage key.
The cluster runs as a workspace service principal that is granted the right to use the storage credential through the metastore, and every read or write flows through that credential.
The audit log records the user, the table, the credential, and the path on every access.
💡 Exam Trap: A user who can read an external table cannot necessarily list the underlying files directly with
dbutils.fs.ls(). Direct file access requiresREAD FILESon the external location, which is a separate grant fromSELECTon the table. GrantingSELECTdoes not implicitly grantREAD FILES. The exam will sometimes present a workingSELECTquery and a failingls()call and ask which grant is missing.
Decision Anchor
Choose a managed table when the lakehouse fully owns the dataset, no external tool will write to its files, and predictive optimization should run unattended. Choose an external table when the data already sits in a corporate storage path under contractual obligations that survive the lakehouse, when another writer (a partner pipeline, a non-Databricks engine, a regulated archive) touches the files, or when the drop semantics of managed tables would create an unacceptable production risk.
🎯 Scenario: A clickstream feed lands as partitioned Parquet files into
abfss://landing@finlakeprod.dfs.core.windows.net/clickstream/raw/from a partner ingestion gateway that the data team does not control. The team wants to expose the data as a Unity Catalog Delta table that an analyst group canSELECTfrom, but the partner contract says the partner alone may write to that path. The right answer is to create an external Delta table at that location, bound to an external location and storage credential that grant onlyREAD FILESto the workspace identity. A managed table is the wrong call because it would attempt to own the files and predictive optimization would conflict with the partner writer.
