mardi 10 février 2015

How to add entries to tables in PostgreSQL if the attributes are reliant on other tables?


The problem that I have is something like this:



Users
=========
UserID
Name
Surname

User Group
=========
GroupID
LeaderID

Group Leaders
=============
LeaderID
UserID
GroupID


The problem arises when I try to add a group or a leader. I can't add a leader because no teams exist. Likewise I can't add any teams first because the team requires a leader. I'm not sure if this is an error in my design or the actual SQL programming? I was thinking of removing the relations for now and population the database but that doesn't feel right so I was wondering if anyone can enlighten me here.





Aucun commentaire:

Enregistrer un commentaire