
Explanation:
The correct syntax to add an identity column to an existing Delta table is ALTER TABLE ... ADD COLUMN ... GENERATED ALWAYS AS IDENTITY (or GENERATED BY DEFAULT AS IDENTITY). This feature is native to Delta Lake and ensures unique, auto-incrementing values.
A
ALTER TABLE ... ADD COLUMN id BIGINT AUTO_INCREMENT
B
UPDATE TABLE ... SET id = row_number()
C
ALTER TABLE ... ADD COLUMN id BIGINT GENERATED ALWAYS AS IDENTITY
D
CREATE IDENTITY ON table_name (id)
No comments yet.