SQL Practice Logo

SQLPractice Online

Level 5 - SeniorQuery-Based Questions

Backfill Surrogate Key Safely

Interviewer prompt: legacy_logs has no primary key. Add bigint surrogate key log_id and enforce primary key. Write migration SQL.

Schema Context

legacy_logs(event_ts, level, message)