I have three tables
1. USERS (UID, USER_NAME)
2. AGENCY (AID, AGENCY_NAME)
3. GROUP (GID, GROUP_NAME)
and I have a case where each agency have groups and each group can have users. So, agency is super set which consist of group and group itself have users.
Now I am wondering what field to put in the new table(s) so that i can make following different queries.
1. List the users in the group in the agency.
2. List the groups in the agency.
Currently I have single table GROUPING(ID, AGENCY_ID, GROUP_ID, USER_ID). Easy with this is I can do query#1. I can do second query also but is this a good design?
Is there any optimum/efficient design for this situation?
Any help will be appreciated.