X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 73B5B30F891 for ; Tue, 24 Jun 2003 05:16:59 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 28517-10 for ; Tue, 24 Jun 2003 02:16:49 -0300 (ADT) Received: from water.oasis.net.au (water.oasis.net.au [210.8.139.2]) by svr1.postgresql.org (Postfix) with ESMTP id 07FCE30F8A9 for ; Tue, 24 Jun 2003 02:16:47 -0300 (ADT) Received: from oasis.net.au (guardian [210.8.139.5]) by water.oasis.net.au (8.9.3/8.9.3/Debian 8.9.3-21) with ESMTP id PAA24919 for ; Tue, 24 Jun 2003 15:32:59 +1000 X-Authentication-Warning: water.oasis.net.au: Host guardian [210.8.139.5] claimed to be oasis.net.au Message-ID: <3EF7DED7.2030304@oasis.net.au> Date: Tue, 24 Jun 2003 15:17:11 +1000 From: Rudi Starcevic User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.3) Gecko/20030312 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Database Design Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.7 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50, USER_AGENT_MOZILLA_UA, X_ACCEPT_LANG, X_AUTH_WARNING X-Spam-Level: * X-Archive-Number: 200306/277 X-Sequence-Number: 14035 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.