Skip site navigation (1) Skip section navigation (2)

db design question

From: "Jules Alberts" <jules(dot)alberts(at)arbodienst-limburg(dot)nl>
To: pgsql-novice(at)postgresql(dot)org
Subject: db design question
Date: 2002-10-15 14:01:51
Message-ID: 200210151404.g9FE4kTY028669@artemis.cuci.nl (view raw or flat)
Thread:
Lists: pgsql-novice
Hello everyone,

I'm currently designing the structure of our new pg database, and I 
have a question. In our current platform, addresses are stored in 
several places, like this (in semicode):

  company(name varchar(100), street varchar(100), state varchar(100))
  employee(code int, street varchar(100), state varchar(100))
  consultant(name varchar(50), street varchar(100), state varchar(100))

The colums street and state (and a lot more in real life) are the same. 
My idea for the new db was someting like this:

  company(name varchar(100))
  employee(code int)
  consultant(name varchar(50))
	address(ref_oid OID, street varchar(100), state varchar(100))

In this way, I can store all the addresses together and find them with. 
SELECT * WHERE addres.ref_oid = company.oid;

Sort of the same manner as the storeage of BLOBs. Is this approach 
common practice? Is it safe? I know I have to make backups with the 
OIDs etc., but besides that, any more pitfalls?

TIA!

Responses

pgsql-novice by date

Next:From: mattDate: 2002-10-15 16:17:36
Subject: Webmin -postgres (Really Novice) Help
Previous:From: Thilo HilleDate: 2002-10-15 12:51:17
Subject: crash - kernel or postgres?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group