, ,
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,
decimal_data decimal(6,2) null,
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};
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};
, . , ( , bool 0).