Home Forums Programming General Require help in creating table RE: Require help in creating table

  • The schema definition seems odd. You might find that things become easier if you change the definition of the Employee table to be something like

    Employee (user_id not null references User(UserID), ClientID not null references Client(ClientID), ...other attributes..., primary key (UserID,ClientID))

    so that the Employee table (which is a table where each row shows the relationship between a client and a user, not a table describing an entity) has the compound primary key required to indicate the client and user for which the row with that primary key describes the relationship. That will eliminate the dummy entity identifier EmployeeID, which you can't use as a primary key despite the statement in your first post that it is the primary key because it's not unique: the data in your post has two rows with the same value for that column, and which is in any case clearly being used to say which user is involved, not which Employee relationship.

    Tom