var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Multiple records in one cell
This is my firs message in forum so hi to everybody
I need idea about my database structure
Here is my table named “Hfacilities”
1 |S Pool
And table named “hotels”
1 |Test |1,4,6
This is the first idea of my that splitting hFacilities cell and getting values from Hfacilities table.i think this is not true way.Also one of my idea is creating one more table like this
1 |2 |1
2 |3 |1
3 |4 |1
But i think it can be create a lot of data because every hotel have 10-20 facilities and there are more than 300 Hotel.can it be problem?
So i am very confused, can anybody help me ?
You should not be storing data as comma separated strings, so your idea of splitting it into another table is correct.
This process is called "database normalization". Read up on it.
storing multiple comma-delimited values in a single column is a disaster -- don't do it
instead, use the additional table, but do not create a separate auto_increment column for it
CREATE TABLE hotel_facilities
( hid INTEGER NOT NULL
, fid INTEGER NOT NULL
, FOREIGN KEY ( hid ) REFERENCES hotels ( hid )
, FOREIGN KEY ( fid ) REFERENCES hFacilities ( fid )
, PRIMARY KEY ( hid, fid )
thank you very much blindman , i'm gonna read it
also thank you r937, i got it now
Interesting naming convention; hid and fid...
What happens if you have two tables that start with the same letter?
E.g. rooms and reservations?
hehe, maybe i can use 2nd letters like roID and reID do you have another idea?
Originally Posted by georgev
They become pretty self explanatory this way too, don't you think?
i must think because you are guru HA not me
Last edited by izmarit; 12-11-08 at 11:52.
Originally Posted by izmarit
you didn't get the HA part
i fixed now
Originally Posted by r937
Standard many to many relationship, need a junction table instead of comma delim values.