From: Rudi Starcevic <rudi@oasis.net.au>
To: pgsql-sql@postgresql.org
Subject: Database design - AGAIN
Date: Tue, 24 Jun 2003 15:19:48 +1000
Message-ID: <3EF7DF74.40700@oasis.net.au> (raw)
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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: rudi@oasis.net.au
Subject: Re: Database design - AGAIN
In-Reply-To: <3EF7DF74.40700@oasis.net.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox