Database design - AGAIN

From: Rudi Starcevic <rudi(at)oasis(dot)net(dot)au>
To: pgsql-sql(at)postgresql(dot)org
Subject: Database design - AGAIN
Date: 2003-06-24 05:19:48
Message-ID: 3EF7DF74.40700@oasis.net.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi,

Sorry - I make some typo's - here is the question again.

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
infokiosk
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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Nicolas JOUANIN 2003-06-24 06:49:21 Re: TR: Like and =
Previous Message Rudi Starcevic 2003-06-24 05:17:11 Database Design