Re: Database Design - Relationsships

From: Lennart Jonsson <>
Date: 20 Sep 2002 11:49:11 -0700
Message-ID: <> (Patrik) wrote in message news:<>...
> *Primary Key
> TimeLog Customers Projects
> --------- -------- -----
> *TimeLogID *CustomerID *ProjectID
> CustomerID ProjectNo
> ProjectID CustomerID
> You can enter a record in the timelog table without having a project
> e.g. an employee may do a job for a customer that does not have any
> project numbers.
> I want to make sure if the user picks a project it is a project that
> has the same customerid as the entered customerid in other words: a
> Time log entry should not be able to have one customerid and a project
> with another customerid. I know how to prevent this in the GUI but I
> want to prevent it in the database design.
> How should these tables be structured?
> /Patrik

One way is to remove customerid from timelog, and instead have a "no particular project' entry for each customer in the projects table.

just a thought
/Lennart Received on Fri Sep 20 2002 - 20:49:11 CEST

Original text of this message