r/Database • • 1d ago

Need help with database design

Hello dear community,

I am making an app to buy plane tickets. (school environment).

However, I am not very sure about it.

Is it too light ?

Thanks to everyone who take time!

1 Upvotes

5 comments sorted by

1

u/NW1969 1d ago edited 1d ago

A few thoughts

- Flight: these attributes should probably be FKs to other entities
Departure_IATA
Arrival_IATA
Compagny
Plane

- Ticket: a ticket normally only references a single person. Maybe you need a booking entity and then 1 ticket per traveller?

1

u/Silane_labanane 1d ago

You are right, it is supposed to be 1 ticket per person so I will definitly change "travellers".

However, I don't get why the FK.

1

u/NW1969 1d ago

FK: because, presumably, they are referencing entities that have their own attributes e.g. a plane has a manufacturer, a model number, a unique identifier/callsign, number of seats, date of manufacture, etc

2

u/squadette23 1d ago

Here is a long-ish tutorial on database design, using a non-trivial problem as an example: https://kb.databasedesignbook.com/posts/google-calendar/

1

u/Discordbothost 1d ago

Try inserting a flight with an arrival code that isn't in your airport table. A foreign key makes the database reject that typo. You can still store just the code on each flight and look up the airport name from the airport table when you display it.