A train company wants to do a booking reservation website and is thinking how to
ID: 3705316 • Letter: A
Question
A train company wants to do a booking reservation website and is thinking how to prevent a double booking of a seat in the case two people are trying to book the same seat at the same time for a particular train. Write a paragraph or write a pseudo code explaining what database design recommendations would you provide to the train company in order to avoid a double booking? (You should mention which SQL statements would you use)A train company wants to do a booking reservation website and is thinking how to prevent a double booking of a seat in the case two people are trying to book the same seat at the same time for a particular train. Write a paragraph or write a pseudo code explaining what database design recommendations would you provide to the train company in order to avoid a double booking? (You should mention which SQL statements would you use)
A train company wants to do a booking reservation website and is thinking how to prevent a double booking of a seat in the case two people are trying to book the same seat at the same time for a particular train. Write a paragraph or write a pseudo code explaining what database design recommendations would you provide to the train company in order to avoid a double booking? (You should mention which SQL statements would you use)
A train company wants to do a booking reservation website and is thinking how to prevent a double booking of a seat in the case two people are trying to book the same seat at the same time for a particular train. Write a paragraph or write a pseudo code explaining what database design recommendations would you provide to the train company in order to avoid a double booking? (You should mention which SQL statements would you use)
Explanation / Answer
Even it is through website or anything each and every thing will be stored in the form of table in database.Now let say for the train company it would definitly have multiple tables which are for availableseats and for bookedseats in a train.So when two people try to book the same seat at same time there will be time stamps for these two transactions. So now the transaction comes to reserve the seat it will check the bookedseats table for the seat no . If there is entry with that seat no means it was booked by other transaction other wise it will book the seat. Even the both transactions initiated at same time towards the same seat there will be some atleast milli seconds gap between those because of internet speed , etc like that.
For this to check the booked seats table I will use select statement only like
This will search for that seat no and will book. During creation of the tables in database we have to set the seatno attribute as primary key. So that it will never book the same seat again if there is entry in the table.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.