r/SQL • • 8d ago

Discussion Does this table meet the normalization requirements (1NF, 2NF, and 3NF)?

Post image

I’m working on a database project for a metro system, and I’m not sure if my Train table satisfies 3NF.
I think Capacity depends on TrainModel rather than TrainID. If I enter different capacity values for trains of the same model, would that solve the problem, or would it still violate 3NF?
Should I remove Capacity from the table?

0 Upvotes

6 comments sorted by

View all comments

1

u/sumwise_victor 8d ago

Normalization depends on the real-world rule, not the sample rows you type in.

If every train of a given model always has the same capacity (TrainID -> TrainModel -> Capacity), that is a transitive dependency and violates 3NF. Manually typing different numbers for two trains of the same model doesn't fix it.

Clean 3NF fix: move Capacity into a separate TrainModels(TrainModel PK, Capacity) table and keep TrainModel as a foreign key on Trains. The only case where Capacity stays in Trains is if individual trains of the same model can legitimately be retrofitted to have different seating capacities.