Re: Bill of materials / Groups in Groups

From: <joe_celko_at_my-deja.com>
Date: 2000/01/26
Message-ID: <86nuja$39s$1_at_nnrp1.deja.com>#1/1


>> I'd wager that if you can define "domain constraint" so that your two
constraints above qualify, then I can show that my ridiculous one-table employee + department example from 1/13 is in DKNF by that definition!<<

Not without a uniqueness constraint on the table. Also the pair of emp_id and dept_id had no restrictions on it, so you could get a cross join of those two domains. What you could have done is:

 CREATE TABLE Personnel
 (emp_id INTEGER NOT NULL PRIMARY KEY,
  emp[_name CHAR(30) NOT NULL);

 CREATE TABLE Departments
 (dept_id INTEGER NOT NULL PRIMARY KEY,
  dept_name CHAR(20) NOT NULL);

 CREATE TABLE Assignments
 (emp_id INTEGER NOT NULL

         REFERENCES Personnel(emp_id)
         ON DELETE CASCADE
         ON UPDATE CASCADE,
  dept_id INTEGER NOT NULL
         REFERENCES Departments(dept_id)
         ON DELETE CASCADE
         ON UPDATE CASCADE,

  PRIMARY KEY (emp_id, dept_id));

When you had both the empty and department names in one table, you had FDs on partial keys. You might want to add an assignment_nbr as the key to this table, but that would depend on the semantics of the situation.

--CELKO-- --CELKO-- Sent via Deja.com http://www.deja.com/
Before you buy. Received on Wed Jan 26 2000 - 00:00:00 CET

Original text of this message