Вы можете сделать сопоставление, как предлагалось ранее, но включить значение в сопоставление
Стол отеля
create table hotel_table (
id int(4) unsigned not null auto_increment primary key,
hotel_name varchar(40) not null,
...other row info
);
Критерии отеля
create table hotel_criteria (
id int(4) unsigned not null auto_increment primary key,
criteria_name varchar(40) not null
);
Карта отеля Критерии
create table hotel_criteria_map (
id int(4) unsigned not null auto_increment primary key,
hotel_id int(4) unsigned not null,
criteria_id int(4) unsigned not null,
string_data varchar(20) null, #use this to add in extra string information for criteria
decimal_data decimal(6,2) null, #use this to add in extra decimal information for criteria
#... either of the above or other extra info, just giving examples ...
unique key (hotel_id,criteria_id),
foreign key (hotel_id) references hotel_table(id),
foreign key (criteria_id) references hotel_criteria(id)
);
Затем вы можете выбрать эти значения:
select * from hotel_table where id={your hotel id}; #hotel info
select m.*,c.criteria_name from hotel_criteria_map m, hotel_criteria c where m.criteria_id=c.id and hotel_id={your hotel id}; #criteria info
Возможно, есть лучший способ сделать это, но только предложение. Вы могли бы ввести критерии для определенного отеля на карту, только если он относится к этому определенному отелю (по существу, не имеет каких-либо строк карты критериев, которые будут иметь значение 0).