Forbid two accounts sharing the same IBAN
In a fintech app the same IBAN can't belong to two accounts. The check used to live in application code and was sometimes forgotten — time to delegate to the database.
Build accounts with id (primary key), email, and iban, then add a uniqueness constraint named accounts_iban_key on the iban column. After that any second insert with an already-existing IBAN fails with an error.
Just CREATE/ALTER/DROP — no trailing SELECT needed.
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inNo starting schema
This task starts with no tables — you'll create them via CREATE TABLE.