开发者

Database design of Railway reservation system

I am designing Railway reservation system. I am having below tables.

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>)

Passenger is identified by TicketID

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

As one passenger can book ticket for many trains. Their is many to many relation between TicketID and TrainID.

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

I am unable to relate to No of seats in a train and the status. How can i relate those in relation with current table or how can i go with new tables.


Many-to-many relationships are solved with the help of an extra table. In this case the ticket sale table is natural to your domain. See

Database design of Railway reservation system

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜