Train Reservation System Documentation
Train Reservation System Documentation
Individual Assignment
Module Code: CE00318-2-DWDS
Handout Date: February 1st, 2012 Hand in Date: April 20th, 2012
Acknowledgement
I have taken efforts to complete this assignment. However, it would not have been possible
without the kind support of my module lecturer. I would like to extend my sincere thanks to
her. My thanks and appreciations also go to my friends in developing the project and people
Contents
Acknowledgement .................................................................................................................................. 2
1. Introduction .................................................................................................................................... 5
2. Proposed Solution ........................................................................................................................... 5
3. Entity-Relationship Diagram ........................................................................................................... 6
3.1 Entities and its Attributes ....................................................................................................... 7
3.2 Relationship and Entities ........................................................................................................ 8
3.3 Mapping of ERD to Relational Model...................................................................................... 8
Step1: Mapping of Regular Entity Type .......................................................................................... 8
Step2: Mapping of Weak Entity Type ............................................................................................. 8
Step3: Mapping of Relationships (1: M) ......................................................................................... 9
Step4: Mapping of Relationships (N: M) ......................................................................................... 9
Step6: Mapping of Ternary Relationships ....................................................................................... 9
4. Normalization.................................................................................................................................. 9
4.1 Initial Database Schema ........................................................................................................ 10
5. Table Design and Structure ........................................................................................................... 12
5.1 tb_1passenger....................................................................................................................... 12
5.2 tb_1Train ............................................................................................................................... 12
5.3 tb_Route ............................................................................................................................... 13
5.4 tb_TrainStation ..................................................................................................................... 13
5.5 tb_UserRegister .................................................................................................................... 13
5.6 tb_StatusTrain ....................................................................................................................... 14
5.7 tb_Station.............................................................................................................................. 14
5.8 tb_2passenger....................................................................................................................... 14
5.9 tb_2Train ............................................................................................................................... 15
5.10 tb_Reservation ...................................................................................................................... 15
5.11 Database Diagram ................................................................................................................. 16
6. DDL Statements ............................................................................................................................ 16
6.1 Create Database .................................................................................................................... 16
6.2 Create Tables ........................................................................................................................ 16
6.2.1 tb_1passenger............................................................................................................... 16
6.2.2 tb_2passenger............................................................................................................... 17
6.2.3 tb_1Train ....................................................................................................................... 17
DWDS(Railway Reservation System) 4
1. Introduction
In our module DWDS (Database and Web Database Systems), we will learn about the
databases, how they are created and used in websites. We will learn about the different
commands and how to generate a report.
Know talking about our assignment part, we have to design and develop a database based
system which is fully web-enabled. System which, we have to make is “ONLINE RAILWAY
RESERVATION SYSTEM” which is an automated computerized system and designed to
replace the current system and to provide the passengers easy to book their reservations
online. The functionalities and modules of the system are organized in such a well manner
that railway reservation processes and railway policies can be operated very smoothly.
The basic functions being performed by the system are reservation and cancellation. These
functions will be handled with the help of following sub functions: -
2. Proposed Solution
DWDS(Railway Reservation System) 6
Nowadays, lifestyle of every single person is very busy and full of hectic schedule. Nobody
have time to stand in queue for hours and make their reservations. Online reservation system
is the solution for this problem.
Railway administrator is the other part of this system. Administrator has full access and right
of modification to all the information stored in the database at the server. Some of the
facilities which admin can access:
3. Entity-Relationship Diagram
DWDS(Railway Reservation System) 7
UserId
Gender
Passenger
Age
User
Name
password
Reservation Date
Status
Train Status
StationId
Has Station
StationNa
me
StopNo
ArrivalDate
Route
tSource tDestination
Departure
Date
Dist
Train
Has
Entities Attributes
DWDS(Railway Reservation System) 8
4. Normalization
First Normal Form (1NF): Each field in a table contains different information.
Second Normal Form (2NF): Each field in a table that is not a determiner of the
contents of another field must itself be a function of the other fields in the table.
Third Normal Form (3NF): No duplicate information is permitted.
DWDS(Railway Reservation System) 10
User:
Station:
StationId StationName
Train:
Route:
TrainStation:
Reservation:
Passenger:
StatusTrain:
1NF:
Relation in 1NF:
DWDS(Railway Reservation System) 11
User:
Station:
Route:
TrainStation:
Resevation:
StatusTrain:
Train:
Passenger:
Train:
Train2:
Passenger:
Into 1NF
Passenger1
Passenger2
DWDS(Railway Reservation System) 12
All above relations have full functional dependencies, so they are already in 2NF.
Also, they do not have any transitive relations; hence they are also in 3NF.
Fig. 5.1
Constraints: Primary Key: TicketId,
5.2 tb_1Train
Fig. 5.2
5.3 tb_Route
Fig. 5.3
5.4 tb_TrainStation
Fig. 5.4
5.5 tb_UserRegister
Fig. 5.5
DWDS(Railway Reservation System) 14
5.6 tb_StatusTrain
Fig. 5.6
5.7 tb_Station
Fig. 5.7
5.8 tb_2passenger
Fig. 5.8
DWDS(Railway Reservation System) 15
5.9 tb_2Train
Fig. 5.9
5.10 tb_Reservation
Fig. 5.9
6. DDL Statements
6.1 Create Database
Use dbRailway4404
go
6.2.2 tb_2passenger
use dbRailway4404
go
6.2.3 tb_1Train
use dbRailway4404
go
6.2.4 tb_2Train
use dbRailway4404
go
6.2.5 tb_Reservation
use dbRailway4404
go
6.2.6 tb_Route
Use dbRailway4404
go
6.2.7 tb_Station
Use dbRailway4404
go
6.2.8 tb_StationTrain
Use dbRailway4404
go
6.2.9 tb_TrainStation
Use dbRailway4404
go
6.2.10 tb_UserRegister
Use dbRailway4404
go
7. DML Statements
7.1 Search Queries
For updating, deleting the values of tupples, we first search it from the table, if values match
to the searching keyword, then required action take place.
Dim st As String =
ConfigurationManager.ConnectionStrings("train").ConnectionString
con.Open()
Dim da As SqlDataReader = cmd.ExecuteReader()
'cmd.ExecuteNonQuery()
da.Close()
Dim st As String =
ConfigurationManager.ConnectionStrings("train").ConnectionString
con.Open()
Dim da As SqlDataReader = cmd.ExecuteReader()
'cmd.ExecuteNonQuery()
da.Close()
GridView1.EditIndex = -1
bind()
End Sub
sql1 = "insert into tb_1Train values('" & txtTrainNo.Text & "', '" &
txtTName.Text & "', '" & txtSource.Text & "', '" &
txtDestination.Text & "', '" & seat1 & "', '" & seat2 & "', '" &
seat3 & "', '" & fare1 & "', '" & fare2 & "', '" & fare3 & "')"
sql2 = "insert into tb_2Train values('" & txtTrainNo.Text & "', '" &
sunday & "', '" & monday & "', '" & tuesday & "', '" & wednesday &
"','" & thursday & "','" & friday & "','" & saturday & "')"
Dim st As String =
ConfigurationManager.ConnectionStrings("train").ConnectionString
Dim con As New SqlConnection(st)
Dim sql1 As String
sql1 = "insert into tb_Route values('" & txttrainNo.Text & "', '" &
txtstopNo.Text & "','" & txtarrival.Text & "','" & txtdepart.Text &
"', '" & txtdist.Text & "') "
con.Close()
Dim st As String =
ConfigurationManager.ConnectionStrings("train").ConnectionString
Dim sql As String = "update a set a.TrainName = '" & trainname & "',
a.IdSource = '" & sourceid & "', a.IdDestination = '" & destinationid
& "', a.Class1Seat = '" & seatac1 & "', a.Class2Seat = '" & seatac2 &
"', a.Class3Seat= '" & seatac3 & "', a.Class1Fare= '" & fareac1 & "',
a.Class2Fare= '" & fareac2 & "', a.Class3Fare= '" & fareac3 & "' FROM
tb_1Train a INNER JOIN tb_2Train b ON a.TrainNo = '" & trainno & "'"
con.Open()
da.Close()
Dim st As String =
ConfigurationManager.ConnectionStrings("train").ConnectionString
Dim sql1 As String = "update b set b.AvailSun = '" & sun & "',
b.AvailMon = '" & mon & "', b.AvailTue = '" & tue & "', b.AvailWed =
'" & wed & "', b.AvailThr = '" & thu & "', b.AvailFri= '" & fri & "',
b.AvailSat = '" & sat & "'FROM tb_1Train a INNER JOIN tb_2Train b on
b.TrainNo = '" & trainno & "'"
con.Open()
dr.Close()
con.Close()
DWDS(Railway Reservation System) 25
8. Reports
In this Report, all train data are shown in this report like train no, train name, no days train is
available, from where train starts and reaches. All details are shown in this report. This report
is build with the help of crystal report.
In this report, details of all passengers are shown. It will help the admin to maintain the
records of users.
DWDS(Railway Reservation System) 26
9. Toolbar
10. Conclusion
Working on the Project was really a learning experience and we have come a long way in
building our concepts of Computer Engineering. The “Railway Reservation System”
developed is purely based on database (SQL). The overall purpose of this system is to
computerized the whole process and thus prevent the intervening errors.
During the course of this assignment developer has gone through many obstacles which made
her to research and though help in increasing knowledge. After applying all the concepts like
ERD, mapping and normalization techniques now developer is very well clear with all these
concepts and fundamentals which will be going to help in the future.
11. References
DWDS(Railway Reservation System) 27
Book References:
1. Connolly, Thomas and Begg, Carolyn (ed.) (2008) Database Systems, New Delhi:
Dorling Kindersley(India) Pvt. Ltd.
2. Molinaro, Anthony (ed.) (2006) (indain-reprint) SQL Cookbook, New Delhi: Shroff
Publishers & Distributors Pvt. Ltd.
Website References
3. sql server 2008 - How To update Two tables at a time using a single StoreProcedure?
- Stack Overflow. 2013. sql server 2008 - How To update Two tables at a time using a
single StoreProcedure? - Stack Overflow. [ONLINE] Available
at: http://stackoverflow.com/questions/9511899/how-to-update-two-tables-at-a-time-
using-a-single-storeprocedure. [Accessed 3 April 2013].
4. Update Multiple tables at a time . 2013. Update Multiple tables at a time . [ONLINE]
Available at: http://social.msdn.microsoft.com/Forums/en-
US/sqlgetstarted/thread/0335f90f-c9b4-4983-9eb6-39259b6af394/. [Accessed 7 April
2013].