铁路预约系统的数据库设计

问题描述:

我正在设计铁路预订系统。 我在桌子下面。铁路预约系统的数据库设计

StationTable(Contails all the stations to which i can provide the railway service.) 
<StationID>->PrimaryKey 
<StationName> 

TrainTable 
<TrainNumber>-> PrimaryKey 
<TrainName> 
<SourceStationID>->FK StationTable(<StationID>) 
<DestinationStationID>->FK StationTable(<StationID>) 

乘客被TicketID

PassengerTable 
    <TicketID>->Primary key 
    <PassengerID> 
    <PassengerName> 
    <Age> 
    <Sex> 
    <Status> 

认定为一个乘客可以预订车票许多列车。它们在TicketID和TrainID之间有很多关系。

PassengerTrainTable - > FK PassengerTable() - > FK TrainTable()

我无法涉及到无的火车和状态席位。 我如何将这些与当前表格相关联,或者如何与新表格进行联系。

+0

@Hohhi: - Thankq – Shine

多对多关系可以在额外的表格的帮助下解决。在这种情况下,票据销售表对您的域名来说很自然。请参阅the sample here