create or replace table accountranks ( id int auto_increment primary key, accountId int not null, rankIdentifier varchar(40) null, primaryGroup tinyint(1) null, constraint additionalIndex unique (accountId, rankIdentifier, primaryGroup), constraint accountranks_ibfk_1 foreign key (accountId) references accounts (id) ); create or replace index accountIndex on accountranks (accountId); create or replace index rankIndex on accountranks (rankIdentifier);