create table vote ( /* primary key */ vote_id unsigned not null auto_increment, primary key (vote_id), /* reference on record in table which stores users */ user_id unsigned not null, /* reference on record in table which stores nodes */ node_id unsigned not null, /* vote value: adjust field type for your requirements */ value int not null, )