I’m working on a system where people can book tickets and certain passes for events (car passes, etc.).
An event takes place on one or more days. The passes can be linked to multiple events. They can have a default price and pass per ticket ratio (so if you buy, say, 3 tickets you get 1 pass free). These default parameters should be able to be changed on a per event basis, though. When linking a pass to an event, I want to be able to link the pass to certain days of the event aswell. I’m kind of stuck here, my original database design seems to be flawed. Here’s what I currently have:
tblPass
passID
name
price
ticketratio
tblEvent_pass
passID
eventID
price
ticketratio
then finally, a table where the reserved passes get put in, after the order has been made:
tblEvent_pass_reservation
reservationID
passID
day
totalPaid
totalFree
However, with this setup, I seem to keep running into trouble. Could someone have a look here and tell me what I’m doing wrong? I’ll gladly answer any questions you have about the concept of the passes. Thanks a bunch.
I think I got your problem right.
Well, in my way of view, your problem is that your are associating a pass to an event instead of an event-day table.
Look at the following structure:
-tblPass (passID, …)
-tblEvent (eventID, description, …)
-tblEventDay(eventDayID,eventID, day (date), …)
Now you need to link your event days with the pass table so we create another eventday-pass (N to N) connection:
tblEventDay_Pass(eventDayID, passID, pricePaid, … )
If you consider the “ticket” as your base unit you’ll have to link tickets to event days, like “a closed event can only afford 15.000 people so you will only have 15.000 tickets”. If so, the tblEventDay_Pass will get a ticketID which will be the same ID as the available tickets for the event. You’ll need to create another Ticket table and link it to the events table.
Something like this:
https://i.stack.imgur.com/EUrAM.jpg
Hope it helps!:)