drop table foo; create table foo (foo_id int auto_increment primary key, bar_id int); create unique index bar_id_idx on foo (bar_id);