You are on page 1of 14

Term Paper

OF
DBMS
Topic: Railway reservation
system for Indian railways.
SUBMITTED TO SUBMITTED BY
Manal Taneja Summit
Sakhre
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 ER DIAGRAM FOR RAILWAY RESERVATION SYSTEM

3 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 Entity-
Relationship Diagram and Relational Model.

E-R Diagram :-

This is an Entity-Relationship diagram of Train Reservation System

Ph_N C_Na Destinati Total_se


O. mee Add on ats
Origi T_typ
Age n e
C-ID
T_no
CUSTOM TRA
Reserv Arrivalti
ER IN
es mee
Sex
D_tim
CI RESERVA e
State Rentperse
D TION
at
R_Da
BN
te Seats Receipt_
O_
_res 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 Origin Destination T_SEATS Departure Arriva Fair/perseat
Time l
Time
A.C PB2008 chandigar amritsar 70 7pm 12am 500
h
general PB2348 chandigarh bhatinda 60 5am 10pm 500
General PB2010 pathancoat jalandhar 85 2pm 8am 250
SI PB2000 Ludhiana navaseher 75 10am 1am 300

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 Age Addr Ph_No Sex State

10 Ashish 2 Gandhi nagar 9936258296 male gujarat


1 0 gujarat
10 Vinod 2 Pilibhit bareilly 7814322120 Male Utter
2 1 Pradesh
10 Sanjeev 2 Pilibhit bareilly 8968384789 Male Utter
3 1 Pradesh
10 Tushar 2 Maulot punjab 9876550604 emale Punjab
4 1

Reservation Table:-
This table give details about the reservation of train

RESERVATION table retrived by select statement.


Foreign Key

BNo R_Date Seats_reserved CID Receipt_ No


PB2000 08-DEC- 1 101 10101
10
PB2010 09-DEC- 2 102 10102
10
PB2348 10-DEC- 3 103 10103
10
PB2008 31-DEC- 4 104 10104
10

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'