Databricks Data Engineer Associate · Free practice question 11 of 12
ALTER TABLE ADD COLUMNS on Delta
The team at Carlow Marine needs to add a nullable column vessel_class of type STRING to the existing Delta table fleet.silver.vessels without rewriting existing data. Which statement does this?
- A.CREATE OR REPLACE TABLE fleet.silver.vessels (vessel_class STRING)
- B.INSERT INTO fleet.silver.vessels (vessel_class) VALUES (NULL)
- C.UPDATE fleet.silver.vessels SET vessel_class = NULL
- D.ALTER TABLE fleet.silver.vessels ADD COLUMNS (vessel_class STRING)
Show answer and explanation
Correct answer: D. ALTER TABLE fleet.silver.vessels ADD COLUMNS (vessel_class STRING)
Why: ALTER TABLE ... ADD COLUMNS adds new columns to a Delta table as a metadata change, and existing rows return NULL for the new column. CREATE OR REPLACE with a single column would replace the table definition and its data. INSERT and UPDATE cannot reference a column that does not yet exist.
More free Databricks Data Engineer Associate questions
- Delta shallow vs deep clone
- Auto Loader schema hints
- Reading notebook task parameters
- collect_set vs collect_list aggregation
- Triggered vs continuous pipeline mode
- Job maximum concurrent runs
- Job task timeout setting
- SHOW GRANTS on Unity Catalog objects
- Transferring object ownership
- Compute policies for cluster governance
- Spark lazy evaluation transformations vs actions