Three GAA events list two halls. How can one venue edit update both Clonmel listings?
A GAA club website lists three events at two halls. Two events are at the same hall in Clonmel. If the club corrects that hall's capacity, how could one edit fix both listings?
First, list what visitors need: see each event, its hall and the hall's capacity, and filter by date and step-free access. In this starting table, each row is a record and each column is a field. Look at how the skills camp and club quiz repeat the hall name, town and capacity.
Pull the hall name, town and capacity out of the event records. Put the Clonmel hall on one row and the Ennis hall on another. Now the Clonmel capacity has one place to be corrected, even though two events use that hall.
To let visitors filter for step-free access, you need to record whether each hall has it. Think about what stays the same when several events use one hall. Where should you store that field? Pick one answer.
Events one hundred and one and one hundred and two each have a different event ID. That's the primary key in Event. Both rows store venue ID seven as a foreign key. It points to the same Clonmel row, where venue ID is the primary key.
Use text for names and towns. Capacity is a whole-number count, so use an integer. The event and venue IDs in this design are integers too. Store step-free access as a Boolean, true or false, and store the event date as a date so visitors can filter by a date range.
Give Clonmel venue ID seven and Ennis venue ID eight. The skills camp gets event ID one hundred and one and links to venue seven. The club quiz gets event ID one hundred and two and also links to seven. Medal night gets event ID one hundred and three and links to eight.
A new event has event ID two hundred and five. It's going to take place at venue twelve, where another event is already booked. Which pair should you store in the new event row? Pick one answer.
If you link an event using just the name Community Hall, it could match Clonmel or Ennis. The name alone can't tell you which hall the event uses. Venue ID seven picks out one row, and venue ID eight picks out the other.
In a schema question, mark Event as many and label its primary key. Draw the foreign key arrow from Event's venue ID to Venue's venue ID, its primary key. Mark Venue as one. On the site, JavaScript sends your dates. The server uses SQL to join and filter rows. You see matching listings.