Question :
I’m working on a “Event Management System” Online Software Project where the system requires the following:
- Viewers can sign up for their user account
- Events can be created by the admin from the admin panel
- Each event requires that the student has a set of attributes
- The required attribute for an event may or may not exist in the
user’s details table - When the user wants to apply for participation in an event, the
system will prompt for the missing attributes - Once the user fills in the missing attributes, the system will
accept an application for the event, from the user.
To solve this one I created the following tables.
- users (user_id [PK], username, password, user_level)
- userdetails (user_id [FK], name, address, attr1, attr2, attr3, … , attrN)
- event (event_id [PK], event_start, event_end, event_title)
- eventdetails (event_id [FK], … )
How do I relate the eventdetails and the userdetails, such that the eventdetails
requires a tuple of n attributes from the userdetails table?
I was thinking something like:
The system will add n colums to the userdetails field as soon as a new event is
created by the admin.
Am i thinking in the proper way?
Answer :
I think you want a lookup table that shows the requirements for a particular event. In this case, generally I would also have attr1-3 in a separate table called ‘Attribute’ and a user_attribute table to assign attributes to a particular user_detail record. Then, you could assign a particular event to require n attributes through the lookup table-
event_attribute (event_attribute_id [PK], event_id [FK], attribute_id [FK],…).