Term Paper OF DBMS Topic: Railway reservation system for Indian railways. SUBMITTED TO Manal Taneja Sakhre
SUBMITTED BY Summit E2803A10 10803929
ACKNOWLEDGEMENT
I Summit Sakhre feel great pleasure in submitting this project as the culmination of my guideās efforts. This project required hard work; sincerity and devotion that I tried my best to put in this project and in turn gained a lot of knowledge from this project. I am deeply grateful to my teacher who has helped me in completion of this project. She has been a constant guiding force and source of illumination for me. I would like to thank her for her valuable advice and guidance. I am also thankful to my friends who helped me in this project. With their combine efforts I complete this project. At last but not least, I am thankful to the almighty god with whose grace I was always motivated and able to complete the project and
Summit Sakhre
CONTENTS S NO.
TOPIC
1
INTRODUCTION
2
ENTITY RELATIONSHIP DIAGRAMS 2.1
3
ER DIAGRAM FOR RAILWAY RESERVATION SYSTEM
RELATIONAL MODEL 3.1
TABLE FOR TRAIN
3.2
TABLE FOR CUSTOMER
3.3
TABLE FOR RESERVATION
3.4
CANCELLATION OF RESERVATION
3.5
QUERIES
4
ADVANTAGES OF RAILWAY RESERVATION SYSTEM
5
SORCE CODE
ABSTRACT This term contains Introduction to the Railways reservation system .It is the computerized system of reserving the seats of train seats in advanced . It is mainly used for long root . On-line reservation has made the process for the reservation of seats very much easier than ever before.
In our country India, there are number of counters for the reservation of the seats and one can easily make reservations and get tickets. Then this term paper contain entity relationship model diagram based on rail reservation system and introduction to relation model .There is also design of the database of the rail reservation system based on relation model. Relation model has three relation RAIL_DETAILS , C_DETAILS and RESERVATION. Example of some SQL queries to retrieves data from rail management database.
RAILWAY MANAGEMENT SYSTEM
:- railway management System is
the computerized system of reserving the seats of train seats in advanced . It is mainly used for long root . On-line reservation has made the process for the reservation of seats very much easier than ever before. In our country India, there are number of counters for the reservation of the seats and one can easily make reservations and get tickets. Almost all of the manual reservations centres have been converted into computerized reservation centers, which provide booking and
reservation of the ticket facilities from one station to another. This system is very helpful and it is very easy to operate on it. It allows advanced booking. Computerization system has also made it possible for passengers to book their tickets online and it has also allowed for the checking whether the tickets in waiting list are confirmed or not. It also provides the information regarding fares and timings of the train. An emergency reservation scheme has also been provided by this computerized system. In the train reservation system for a state transport we should have all the details of cities, villages etc to design the database of this system. For this system we have to design the database which have all the information about trains their timing, origin, destination, Roots, Total no. of seats in a particular train. Type of train and the full detail of the passenger for example passenger id , passenger name, phone number, address, seats the passenger wants to reserve etc.
Represention of Train Reservation System for a state transportation with the help of EntityRelationship Diagram and Relational Model. E-R Diagram :This is an Entity-Relationship diagram of Train Reservation System
Ph_N O.
C_Na mee
Destinati on
Add
Origi n
Age
C-ID
Total_se ats T_typ e T_no
CUSTOM ER
TRA
Reserv es
IN
Sex State
RESERVA TION
CI D R_Da te
Seats _res
Rentperse at BN O_
Arrivalti mee D_tim e
Receipt_ no
In this diagram CUSTOMER , TRAIN and RESERVATION are entities and the relationship between them is reserves.
Passenger entity has seven attributes :- C_No, Ph_No , C_Name, Add, Age,Sex,State which defines customer number, phone number, customer name, address, age ,sex and State of customer.
Train entity has eight attributes :- Origin, Destination, T_seats, , T_type , T_no ,T_Timing mean departure time and arrival time of the train. Fair/perseat which defines origin of train, destination of train, total no. of seats in a train, train type and train number,timing of train,fair of reservation for per seat.
RESERVATION relation has five attribute:-
R_Date ,Seats_reserved,CID, Receipt_No,BNO. which defines reservation date , number of seats reserved by passenger,passenger id, Receipt no. given to the customer, train number.
RELATIONAL MODEL:train- Details Table : Firstly, we create a table using CREATE query. Different attributes are defined with data types. Here T_NO is a primary key.
Then we insert values of all the attributes into this table using INSERT SQL query
Select query is used to retrieve data from the relation.
Primary Key T_Type
T_No
A.C
PB2008
general General SI
Origin
Destination
chandigar amritsar h PB2348 chandigarh bhatinda PB2010 pathancoat jalandhar PB2000 Ludhiana navaseher
T_SEATS
Fair/perseat
70
Departure Arriva Time l Time 7pm 12am
60 85 75
5am 2pm 10am
500 250 300
10pm 8am 1am
500
Relation named train_Details is created which stores the information about train.
2) C-Details Table: This table give the all the details of the passenger. in this table C_ID is the primary key so that there is no duplicacy of the passenger . We have to create another table passenger using CREATE query
To retrieve the passenger table we again apply Select statement.
Primary key
C_ID.
C_Name
10
Ashish
10
Vinod
1
Age
Addr 2
Sex
9936258296
male
gujarat
2
7814322120
Male
2
Pilibhit bareilly
8968384789
Male
2
Maulot punjab
9876550604
emale
Utter Pradesh Utter Pradesh Punjab
1 10
Sanjeev
3
1 10
Tushar
4
State
Gandhi nagar gujarat Pilibhit bareilly
0
2
Ph_No
1
Reservation Table:This table give details about the reservation of train
RESERVATION table retrived by select statement.
Foreign Key BNo PB2000 PB2010 PB2348 PB2008
R_Date 08-DEC10 09-DEC10 10-DEC10 31-DEC10
Seats_reserved 1
CID 101
Receipt_ No 10101
2
102
10102
3
103
10103
4
104
10104
Relation named RESERVATION is created which stores the information about reservation of train In this relation T_No act as a foreign key references from train_details.
Cancelation of TICKET or Reaervation:- If any passanger wants the cancelation of his tickets or reservation then the deletion of this particular reservation record from database is done using DELETE SQL query.
. SHOW CANCLED TICKET
SOURCE CODE 1.create table rail_details(R_type varchar2(10), B_No varchar2(20)Primary Key, origin varchar2(15), details varchar2(20), total_seats number(10), dept_time varchar2(20), arr_time varchar2(20), fairperseat number(20));
2.insert into rail_details values('Sl', 'pb2000', 'Ludhiana', 'navaseher', 75, '10pm','1am', 300);
3.create table c_details(c_id number(20)primary key, c_name varchar2(20), age number(20), addr varchar2(30), ph_no number(11), sex varchar2(7), state varchar(20));
4.insert into c_details values('101', 'Ashish', '20', 'gandhi nagar gujrat', '9936258296', 'Male', 'Gujrat'); insert into c_details values('102', 'Vinod', '21', 'Pilibhit bareilly', '7814322120', 'Male', 'Uttar Pradesh'); insert into c_details values('103', 'Sanjeev', '21', 'Pilibhit bareilly', '8968384789', 'Male', 'Uttar Pradesh'); insert into c_details values('104', 'Tushar', '21', 'Malout Punjab', '9876550604', 'Male', 'Punjab'); insert into c_details values('105', 'Summit', '21', 'D.L.W. Varanasi', '8968384798', 'Male', 'Uttar Pradesh);
5.create table RESERVATION (BNO varchar2(30), R_Date date, Seats_Reserved number(20), CID number(10), receipt_no number(10), foreign key (BNO) references rail_details(B_no) );
6.insert into RESERVATION values('pb2000', '08-DEC-10', '1', '101', '10101'); insert into RESERVATION values('pb2010', '09-DEC-10', '2', '102', '10102'); insert into RESERVATION values('pb2348', '10-DEC-10', '3', '103', '10103'); insert into RESERVATION values('pb2008', '31-DEC-10', '4', '104', '10104');
7.DELETE from RESERVATION where CID='103'