0% found this document useful (0 votes)
2 views

Train Booking Database Challenge

The Train Booking Database Challenge requires groups to design and implement a database project, including creating an Entity-Relationship Diagram (ERD) and a booking.sql file. The project spans four days, focusing on defining entities, planning data flow, and ensuring collaboration among group members. Deliverables include a clear ERD, a SQL file with table creation and sample data, and a public GitHub repository for submission.

Uploaded by

oliverwekesa337
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Train Booking Database Challenge

The Train Booking Database Challenge requires groups to design and implement a database project, including creating an Entity-Relationship Diagram (ERD) and a booking.sql file. The project spans four days, focusing on defining entities, planning data flow, and ensuring collaboration among group members. Deliverables include a clear ERD, a SQL file with table creation and sample data, and a public GitHub repository for submission.

Uploaded by

oliverwekesa337
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

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:

● Design the database schema.


● Create the tables and define constraints (e.g., primary keys, foreign keys,
unique constraints).

Day 3:

● Populate the database with sample data.


● Test and ensure relational integrity between tables.

Day 4:

● Finalize the database schema.


● Create or update the ERD based on the implemented schema.
● Prepare for the presentation.
Deliverables
1) ERD:
a) A clear and accurate Entity-Relationship Diagram reflecting the final
database design.
2) Database SQL File:
a) A single booking.sql file containing:
i) Table creation scripts with constraints.
ii) Scripts to populate the tables with sample data.
3) GitHub Repository:
a) Each group must create a GitHub repository and upload:
i) The final ERD should be in image or PDF format. Use tools like
draw.io, Lucidchart, or MySQL Workbench to draw the ERD
ii) The booking.sql file.

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.

Tips for Success


● Ensure all tables have primary keys and necessary foreign keys.
● Use meaningful data when populating the database. Example: For a train
booking system, include real-world examples like train numbers, passenger
names, and booking dates.
● Validate data integrity by running queries to test the relationships.
● Collaborate effectively as a group but ensure individual understanding for the
final submission.

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.

Column Datatype Description Sample Data

id int Primary key. A unique identifier 1,2,3


for the row

station_na varchar A name of the train station, Penn Station, South


me which can be displayed on the Station
website for users to identify it.

train_journey

A single journey of a train that starts at one station at one time and ends at another
station at another time.

Column Datatype Description Sample Data

id int Primary key. A unique identifier for 1,2,3


the row

schedule int A foreign key to the schedule 1,2,3


_id record for this journey, so we can
tell whether this journey is for a
Weekday, Weekend, or some
other schedule.

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

A combination of all of the stations that are included in a train journey

Column Datatype Description Sample Data

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.

Column Datatype Description Sample Data


id int Primary key. A unique identifier for 1,2,3
the row.

name varchar A name for the schedule which can Weekday


be displayed on the website and Weekend
understood by users. 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.

Column datatype Description Sample Data

id int Primary key. A unique identifier 1,2,3


for the row.

class_name varchar The name of the class, which First Class


can be shown to a user and Business
understood by a user Economy

seating_capa int The number of seats available 20,100,150,200


city on a carriage of this class. The
maximum number of
passengers that can book for
this class of carriage.

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.

Column Datatype Description Sample Data

journey_id int A foreign key to the train 1,2,3


journey table, to indicate
which journey this
carriage is for.

carriage_class_ int A foreign key to the 1,2,3


id carriage class table, to
indicate which class this
carriage is for.

position int The position in the train 1,3,6,8


that the carriage sits. This
can help with printing on
tickets or informing the
passenger where their
carriage is..

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.

Column Datatype Description Sample Data

schedule_id int A foreign key for the 1,2,3


schedule that identifies
which schedule the price
applies

carriage_class_ int A foreign key for the 1,2,3


id carriage class that
identifies which class the
price applies to

price decimal The price for the 100,200,800


combination of schedule
and class

booking

A record of a booking that a passenger has made, with references to all of the other
information for the booking.

Column Datatype Description Sample


Data
id int Primary key. A unique identifier 1,2,3
for the row.

passenger_id int A foreign key to the passenger 20,14,1,2,5


table to identify the passenger
that the booking is for

position int The position in the train that 1,3,6,8


the carriage sits. This can help
with printing on tickets or
informing the passenger where
their carriage is..

status_id int A foreign key to the booking 1,2


status table to identify the
status of this booking

booking_date date The date that the booking was 2024-08-


made 30,
2022-09-
21,
2024-03-
05

starting_station_id int A foreign key to the train 3, 15, 29


station table to identify the
station that the booking starts
at (the station where the
passenger gets onto the train).

ending_station_id int A foreign key to the train 4, 18, 22


station table to identify the
station that the booking
finishes at (the station where
the passenger gets off the
train)

train_journey_id int A foreign key to the train 1, 3, 6


journey table, to indicate the
journey that has been booked
by the passenger.

ticket_class_id int A foreign key to the 1, 2, 3


carriage_class table, to indicate
the class of the ticket that the
passenger has booked.

amount_paid decimal The amount paid for this 200,1500,7


booking by the passenger 00
ticket_no int A number that identifies the 15, 80, 231
ticket for this booking, which
can be printed or displayed on
the ticket.

seat_no int The number of the seat that 3, 15, 29


the passenger has booked on a
carriage. This can be printed or
displayed on the ticket

passenger

The passenger who has made the booking, and also the person who can login to the
booking system

Column Datatyp Description Sample Data


e

id int Primary key. A unique identifier 1,2,3


for the row.

first_name varchar The first name of the John


passenger Sandip
Stephanie

last_name varchar The last name of the passenger Kumar


Smith
Jones
email_address varchar The email address for the [email protected]
passenger, which can be used
to send booking details to and
to login.

password varchar The password for this An encrypted value


passenger for logging into the for the password
booking system.

booking_status

A lookup table for the status of a booking, such as Active or Cancelled.

Column DataType Description Sample Data

id int Primary key. A unique identifier for 1,2,3


the row.

name varchar The status value that is shown on Active


the screen and understandable by Cancelled
the user Pending

References

How to draw an ERD

How to draw an ERD

Draw.io

You might also like