Re: One to One relationships

From: Bernard Peek <bap_at_shrdlu.com>
Date: Thu, 1 May 2003 01:12:41 +0100
Message-ID: <ip1rblB5ZGs+Ewns_at_diamond9.demon.co.uk>


In message <b8eriu$7k1$1_at_slb2.atl.mindspring.net>, Rich Dillon <richdillon_at_mindspring.com> writes

>Stu,
>
>It is hard to come up with good examples of 1:1 relationships between
>different kinds of things, but let's pretend that we're a medical practice
>and take the example of patients and charts, which is the closest thing to
>your problem that comes to mind.
>
>Option A:
>
>CREATE TABLE patients (
> patient_id INT NOT NULL PRIMARY KEY,
> last_name VARCHAR(30) NOT NULL,
> first_name VARCHAR(30) NOT NULL,
> dob DATE NOT NULL,
> ...);
>
>CREATE TABLE charts (
> chart_no INT NOT NULL PRIMARY KEY,
> patient_id INT NOT NULL UNIQUE REFERENCES patients (patient_id),
> created_date DATE NOT NULL,
> created_by INT NOT NULL REFERENCES personnel (emp_id),
> ...);
>
>Every patient has exactly one chart forever. In fact, in the minds of many
>of the administrative staff (hopefully not the physicians), patients and
>charts are the same thing.

[Quoted] Are you sure that patients only have one chart forever? Suppose a patient is discharged and then readmitted for an unrelated illness. Don't they then get a new chart?

-- 
Bernard Peek
bap_at_shrdlu.com
www.diversebooks.com: SF & Computing book reviews and more.....

In search of cognoscenti
Received on Thu May 01 2003 - 02:12:41 CEST

Original text of this message