Re: DBDesign Q2:
Date: Thu, 27 Nov 2003 11:41:37 -0000
Message-ID: <Bp6dna5zxsvBf1iiRVn-hQ_at_giganews.com>
The following seems to match your business rules. Treat Department Manager
as an attribute of the Department rather than the Employee.
CREATE SCHEMA AUTHORIZATION dbo
CREATE TABLE Employees (empno INTEGER PRIMARY KEY, deptno INTEGER NOT NULL
REFERENCES Departments (deptno), UNIQUE (deptno, empno))
CREATE TABLE Departments (deptno INTEGER PRIMARY KEY, deptname VARCHAR(20)
NOT NULL UNIQUE, deptmanager_empno INTEGER NOT NULL, FOREIGN KEY (deptno,
deptmanager_empno) REFERENCES Employees (deptno, empno))
The usual caveat about design questions applies: it's very difficult to give
design advice online without the opportunity to research a particular
situation in detail.
--
David Portas
Please reply only to the newsgroup
--
Received on Thu Nov 27 2003 - 12:41:37 CET