Hi,
I have a Spread Sheet which I need to make a searchable directory out of.
I'm in two minds on a couple things so I thought I'd ask.
I"m not sure whether to have on larger table or 2 smaller one with a
join table.
This is a trimmed down version of the data.
The directory is of Camping grounds/parks.
Here is a sample of the fields:
Park Name
Info Kiosk
Tent
Caravan
Toilets
Wheelchair
Water
Shower
Telephone
One large table may look like:
CREATE TABLE grounds
(
id serial PRIMARY KEY,
parkname varchar(120),
infokiosk bool NOT NULL,
tent bool NOT NULL,
caravan bool NOT NULL,
toilets bool NOT NULL,
wheelchair bool NOT NULL,
water bool NOT NULL,
shower bool NOT NULL,
telephone bool NOT NULL
);
Two smaller tables with a join table may look like:
CREATE TABLE grounds
(
gid serial PRIMARY KEY,
parkname varchar(120)
);
CREATE TABLE features
(
fid serial PRIMARY KEY,
feature varchar NOT NULL
);
INSERT INTO features ( feature ) VALUES ( 'infokiosk' );
INSERT INTO features ( feature ) VALUES ( ' tent' );
INSERT INTO features ( feature ) VALUES ( ' caravan' );
INSERT INTO features ( feature ) VALUES ( ' toilets' );
INSERT INTO features ( feature ) VALUES ( ' wheelchair' );
INSERT INTO features ( feature ) VALUES ( ' water' );
INSERT INTO features ( feature ) VALUES ( ' shower' );
INSERT INTO features ( feature ) VALUES ( ' telephone' );
);
-- join table
CREATE TABLE grounds_features
(
gid int4 REFERENCES grounds ON UPDATE CASCADE ON DELETE CASCADE NOT NULL,
fid int4 REFERENCES features ON UPDATE CASCADE ON DELETE CASCADE NOT NULL
);
For this task, a searchable directory, which design would be better.
In know the second is more flexible as new features can be added but I
have very limited time and
I think the one larger table design would be quicker to build.
The front end will be either ColdFusion or PHP - I haven't decided yet.
Thank you kindly
Best regards
Rudi.