Train Booking Database Challenge
Train Booking Database Challenge
Objective
This challenge is designed to help learners understand and implement database
design principles. Each group will develop an Entity-Relationship Diagram (ERD) and
collaboratively implement a database project. To complete the task, learners must
submit their work as a group by creating a repository, with the group leader
responsible for sharing the final repository containing both the ERD and the finalized
booking.sql file.
Instructions
1. Create an ERD
○ Clearly define all entities (tables) and their attributes.
○ Understand and document the relationships between tables.
○ Identify primary keys, foreign keys, and other constraints.
○ You can use tools such as Lucidchart, draw.io, dbdiagram.io, or MySQL
Workbench to create the ERD.
2. Plan the Data Flow
○ Map out how data flows between entities
○ Discuss as a group how the database will be structured and
implemented.
3. Group Collaboration
○ Work as a group to analyze, design, and implement the database.
○ Each member is responsible for understanding all aspects of the
project.
4. Submission
○ Each group must create a GitHub repository and make it public so that
it is accessible to the reviewer.
○ Submit the final ERD and booking.sql file to the repository.
Timeframe
The project is to be completed in 4 days, from 06-01-2025 to 10-01-2025
Day 1:
● Create an ERD.
● Demonstrate table relationships, including primary and foreign key usage.
● Plan the database structure.
Day 2:
Day 3:
Day 4:
Evaluation Criteria
1. Database Design (30%)
○ Correct implementation of the ERD.
○ Proper use of primary and foreign keys.
2. Sample Data (20%)
○ Data is diverse, meaningful, and realistic.
○ Proper use of foreign key relationships while inserting data.
3. ERD (20%)
○ The ERD accurately reflects the final database schema.
○ Clear, readable, and correctly labeled relationships.
4. Presentation (20%)
○ Clear explanation of the database design and ERD.
○ Team collaboration and engagement during the presentation.
5. Adherence to Timeframe (10%)
○ Completion of tasks according to the 4-day timeline.
Database Definition
train_station
A train station that exists on the train network. A train can arrive and depart from a
train station as part of its journey.
train_journey
A single journey of a train that starts at one station at one time and ends at another
station at another time.
name varchar The name given to this journey so "9:05 Penn Station to
it can be shown on the website if Boston South Station"
needed "12:45 Chicago to
Washington DC"
journey_station
journey_i int The foreign key to the train journey table, 1,2,3
d to indicate which journey this record is
for.
station_id int The foreign key to the train station table, 1,4,9
to indicate which station this record is
for.
stop_orde int A number that indicates the sequence or 1 for the first
r order that the train journey takes. It can station, 2 for
be used to show the route that the the next
journey takes (the stations and the order station, and
they stop in) so on.
departure date/time The time that the train departs from this 9:10 , 11:15 ,
_time station. 16:21
schedule
A list of different schedules that can be applied to a train journey, because a train
journey can run on a Weekday schedule, a Weekend schedule, or even a public
holiday.
carriage_class
A list of different classes of train carriages. In real trains, different classes have
different quality seating and amenities. In the system, different classes have different
prices and seating capacity.
journey_carriage
A record of carriages for each train journey, because each train has many
carriages, and a carriage can be used for many trains.
carriage_price
A record that captures the price for a ticket on a specific class of carriage for a
specific schedule. For example, a weekday First Class ticket, or a weekend Economy
ticket.
booking
A record of a booking that a passenger has made, with references to all of the other
information for the booking.
passenger
The passenger who has made the booking, and also the person who can login to the
booking system
booking_status
References
Draw.io