0% found this document useful (0 votes)
4K views24 pages

Railway Management System Database Mini Project

This document contains information about a railway reservation system project done by two students. It includes a cover page with the course code, academic year, project title, student names and IDs. It also includes declarations signed by the students and faculty supervisor about the project being the students' own work. The document then provides a brief overview of the railway reservation system and its key features like ticket booking, cancellation and status checking. It also lists some assumptions made to simplify the project. Finally, it includes entity relationship diagrams and sample SQL queries related to the railway reservation database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4K views24 pages

Railway Management System Database Mini Project

This document contains information about a railway reservation system project done by two students. It includes a cover page with the course code, academic year, project title, student names and IDs. It also includes declarations signed by the students and faculty supervisor about the project being the students' own work. The document then provides a brief overview of the railway reservation system and its key features like ticket booking, cancellation and status checking. It also lists some assumptions made to simplify the project. Finally, it includes entity relationship diagrams and sample SQL queries related to the railway reservation database.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 24

Department of Computer Science Engineering

Course code -1SC520ll7

II B.Tech — 2nd Semester

XcadenGcYear I0f8-20f7

RAI AWAY RFSfiRVATtON SYSTEM

Ceccion - S3
Batch No: 6

Sfudcnt ID Student Slime


K. Shasflank Redd
CSE
DEPARTMENT OF CO8IPU TFR SCIENCE ENGIN PER I G

This Is to cc• i r\ i ai kc cuuo c bond pmj ct cntitIc‹t “RAILWAY


RESERYATIUN SYSTEM” is a bonafide work done by K.5hashank
Red4 (t50030407), T. Lai Sai Chand(t50030936) in partial ru1 fihnent of the
rcquircmcn‹ for thc awanJ nf dct,rce in “BACHELOR OF TEC’HNOLO-CiY in
C umputcr Science Engineering” during the acudtmiu ytar 2UI 6-2017

DR. D. RajcsH’ara Rao


DEPARTMENT OF COJVIPUTER SCIENCE ENGINEERING

We hereby declare thal this project based lab report entitled "RAILWAY
RESERVATION SYSTEM" hax been prepamd by us in partial fulfillment of the
requirement for the area »r data -BACHELOR OF TECtJNOt.OGY 1»
COMPUTER CCTENCE ENCINEERINC“ during the academic y¢ar 2016-

Wc also declare that iAis project bescd tab rcport is odour own ciTort and it
has not been submitted to any ott\cr univoaily for tote award of a‹ty degree.

Plnce: Vaddeswaram

ic. Shashank Rcdd 150030407


T. Jai Sai Chand
It is grcat pleasure for mc to cxpmss my gratitude to our honorable President
SrJ. Koneru Satvanarayana, for giving the opportui\ily and platform with
fâc iliti Jñs i n a cc ompIish1^8 t*e Project based laborolory report.

odministratiou fowards our acadvmic growt!t.

I cxprcss sinccr¢ gr8titudc to our Coordinator Dr. A- Satya Kal¿an For


his

acadamic Semester.

I record it as my privilcge to docply tI+ank our pionccr Dr. V. Srikanth,


HOD CSE D«pt
idcas inlo rmalify.

I express my sincere lhanks to our project supervisor Dr.D.Rajeswara Rao

Finally, it is pleased to acknowledge the indebtedness lo all those whn


devoted themselves dimtly or indirectly to make ihis projcct rcpon success

PROJECT ASSOCJATES

Student ID
Shashank Rrdd 150030407
T. Jai Sai Cliand 1 5003ß936
ACKNOWLEDGE\4Ei ITS .

£'ROJECT DESC’RIPTION.

ER Diogrem {CaccgI‹ia1 Model)

SQL Queries laicd to Rcpon Gcncietion


The Railway Rescrvalion Sys‹ racilitatcs 1hc passengers to enquire about
fhc frains available on tho basis of sourc¢ and dcstinafioa, Booking end
Cancellation of tickets, enquire about th¢ slatus of the booLc'd tickot, etc. be aim
of case study is to design and develop a database maintaining lhe records of'
diff‘erent trains, train starus, and passengers.

This project contains Inlroduclior la the R ai Sways reservation


ft is lhe computerized system of reserving lhe seats of fi'ain seals in
advanced. It is mainly used for long route. On-line reservation has made the
process for the rz'servation of scats very much easier than ever before

In our counlry fnd ia, there are number oÏ' counters for the reservation of
lÏie seats and one can easily maLe reservetions and get ticLets. Then lhis project
conlains cnlity zetalionship model 4iagiam based on railway reservation systcm
Tttcrc is also dcsign of the dat8bcsc
of fhc railway res¢rvstion syefcm bescd on mlation mud¢l. Exampl¢ ofhome SÇL
qucries lo mlrieves óatc from mil maaagement daiabasc.
Database is sn organized collection of d‹tta. The detg is typically orgenizcd
\u modol aspects of reality in a way that supports proc<ss¢s requiring information.
A DBMS makes it possible for end users to create, ruad, update and delete data in a
database. The DBMS essentially serves as Bn interface between IJie database and
end users or application programs, ensuring ihal 4aia is coasist¢ntTy organized and
remains c8sily acccssiblc Tkc DBMS manages fhrec important things: thc date. the
database cnginc that altows data to bc accessed. locked and modified and the
database schema, wI\icfi defines lhe database’s 1ogical structure. Thae three
foundations I elemenls help provide concuzzency, security, dala integrily and
uniFonn administration pn›ccdurcs. The DBMS can offer both logical and physical
data indcpcndcnc¢ That mcans it csn protect users and applications from n¢¢ding
fa know whmro da\a is stored or taking \o be concerned about changes to the
physical slructuz¢ of data.

The main purpose of' maintaining database for Railway Reservation Syste T
is to reduce the manual errors involved in the booking and cancelling of wickets and
make it convenient for fhc customers sn4 provi4crr to maintain thc dala about tltcir
cu8tomcrs and also about \ftc seals available at \i\cm.Due \o automation many
loopholes that esist in the manual mainlmance oftI\e reconh can be removed. The
speed of obtaining and processing the data will be fast. For f\ifure expansion the
proposed system can be web enabled so ihat clicnu can make vBzious enquiries
Due to this. sometimes a Koi of problems occur and
fhcy are facing m›uty Jispu\cs witft customers. To solve fhc above problem, we
design a data base which includes customer details, availability of seats in trains,
no of frnins Bnd II\eir details
This p›cject i8 about cr¢ating \t\e daIaba&¢ aboul Railway Reservatio›t System.

The railway rcscrvalion system £ecilitetcs the pnss‹x gcrs to enquiry about
fhc trains svailablc on th¢ basis of source and dcetination, backing and ciinccl1ation
of tickets, enquizu about the status of the boo1ed ticket, etc. The aim of case stucly
is to design and develop a database maintaining the records of diJTerent tiains, bain
starus, and passengers. The record oF uain includes its number, nome, source,
dcstirrBtion, auld days on which it is available, whereas record oF train status
includes datas for which ‹ickcu can b¢ bookc‹L total number of seals ‹tvailsbTc, ard
number of scats already book¢d

Passcnj ers can book their úckets for the train in which scats are avaiJabtc.
For tltis, yzsscngcr has 1o yrovidc tfte dcsircd train numbcr and the da‹c for whictt
ficket is to be book¢d Befor¢ booking a tickct for a passcng¢r, fhc volidify oftmin
number and booking óate is chcckcd Once ttte Itain numbcr and booki‹tg date am
validated, it is checLed wI\ether the seat is avai1able. If' ygs, the ticket is booked
with confirm status and coriesponding ticket ID is generated which is slored along
with oth¢r detalls of rh¢ passcngcr. Th¢ tickct onc¢ bookcd can b¢ canccllcd et any
fimc. For this. th¢ passcngcr h8s to providc the tickct ID (the unique kcy). The
ficket fD is scorchod and \he corrssponding record is det¢ted. With fhis, fhe fi›st
tic1et witlt waitiI\g stalus a1so gels confirmcd.

List of Assumption Since lhe reservation system is very large in reality, it is


not feasible to develop the case study to that cxlent and prepare documentation a1
thai ltvcl, Thcreforc, a small sample case study be been curated to dcmonstraic
the working of the reservation system. To implewuni this sample case study, some
assumptions have been made, which are as follows:

1. The number of trains hns been restricted to 5.

2. Who booking is open only for next seven days from the current dale.

3. Only ‹wo categories nd tickets can be booked, namely, AC anlt General.

4. The total number ofticLets that can be booked in each category (AC nnd
Geneml) is 10.

5. The touil number of tickets lhat can be given ldc slatus of mailing is 2.

6, The in- between stoppage suitions and their book ings arc not considered,

List uf tniins has to be maintainr'd. Dmailcd Passenger information iz to b¢

read from the passenger. On the basis of” the values provided by the passenger,
corresponding record is retrieved from ihe Train Statns. JI the desired category is
AC, then total number of AC seats and number or booked AC sca‹s are compared
in order to finJ whether fickct can be buukc4 or not. Similarly, it cen be checked
for th¢ g¢n¢ral coi¢gory. TF fick¢t ccn bo book¢d. then passenger details am md
and slorcd in the f'assenger table. In Ihe cancellation procedure. ticket ID is mad
passen6er and corresponding record is searched in tfte Passenger. JI the
record exists, it is deleted. After deleting the record (if it is confinned), first record
with wailing status for the samc train and sgmc ca‹cgory are scorched from ‹he
Passenger iablc and its 6\a‹us is changed to confirm.
ENTITES ATTR IBUTES

Aødhat no

State

Security ques
S¢cuõ ty ans

Booked by
Reservation status
Train

B seersI

WScasl

W scełs3

BooLcó user
TRAI

id assen

BOOKS

RGACHEß

siaiion no
lesen user id

TRAIN

CANCEL

BOOKS

STA RTS REACHES

5TOfi8 AT
FINAL LIST OR RfiLATION SHIPS:

• books -T¢mory relation ship hmwccn USLk.TkAlN.PASSENGfiR ‹tn‹l


1”IFKEY.
• starts -Between TRAIN and STATION
• reochcs —Between TRAJN and STATION
• cancel —Between USER and TJCKET
• s‹op.s_at —ßctlvecn TRAIN and STATION
CRGATG COMMANDS:

crcatc tabTc if not exist USER(user id int primary k¢y.firsf nsmc


va›chart50),lasl name varchar{SO),adhar no varcI\ar{20),ge‹tder char,age
int,mobilg eta varChar{50),emcil varchBg50),city ›'archar{30),state
vazchar(5O),pincode varcfiarY20), ssword varchar(30),secuzity ques
varcliar{5O),sccurity ans varchar(30));

create table if not ex sists TRAJN(train no inl primary key,train name


varchar{50),arrival time time,depariure time time,avai1ability of seats char,date
dale);

creale table i£ not exisfs STATION(no inl ,name varchart50),hau\t int,arrival time
time,train noint,prinuiry key(station no,train no),constarint f'oroign key(train no)
references TRAIN( trsin no));

create table if not exsi8ts TRAIN STATUS(tniin no int primuy Ley,b seats I
int,b seats2 int,a seats I int,a seats2 int,w soals I int,w seaTs2 in\,f'aIcI floa\,fare2

char,no of nssertgm int,1rain no int,conslmint tbzuign Ley(user id) references


USER(user id),constraint foreign 1ey(train no) references TRAIN(train no));

cmatc table if not cxieu PASSENGER(passenger id inf primary key,pnr no


int,age inl,gender char,user id inl,wservation stalus chBr,seat number
varcliar{5),name varchar{3O),ticket id int,constrainz foreign key(user id)
references USER(user id),constraint fomign key(ticket id) references
TICKET(id)):
creale tab1t if not exsists STARTS( main no int primczy kcy,stntion nu
int,constIaint foreign key(main no) refcwnces TRAIN(tmin no),cons\rain1 foreign
key(sIalion no) references STATION(no));

create table if not cxsi8ts STOf'S ATt train no int.station ri+ int,conslIaint I+reign
Ley(main no) references TItAfN(train no),constrain\ fbroign Loy(station no)

references STATION{no));

create table if” nut exsists REACH CS(train no ini,slnlion no inI,tim<


time,constraint fbrei n key(train no) reférences TRAIN(train no),constraint
foreign key(xta1ion no) references STATION(no));

create t8blc if not cxsi8ts BOOKS( u or id int,id int.ccnstrcint forciym key(user id)
refewnces US£R(user id),conslraint foreign Let(id) references TICKET(id)).

create tgblc if no{ cxsists CANCEL(user_id int,id int,yassengcr id inf,constr8int


foreign keyt id) n fcrcnccs TICKET(id),consttaint forei keytpaascngcr ids
mfemnces PASSENGER(passenger id),constraint for¢ip ke tu« r id) r
¢fe›cnces USER(user id));

!N5ERT QUERIES:

insert into
USER(uscr_id,first namc,lasf_nainc.8adftar no,gcndcr.agc.inobi\c no.cinail,city,st
atc,yincodc, aSsword,sccurity qucs,sccuñfy_ansJ
values( 1701.'vijay','sharma','309887340843','M',34,'9gS778ft655','vijay I jjmai1.co
m','vijayawada','andhrapradnh','Ji2000l','l234Ji #','fâvouritecolour','rcd’),(J702,'r
ohitft’.'kumar'.'45670987l234','M',4S,'98096GG535','rohithI kuma gmail.com’.'gu
ntur','andhrapradesh','522004’,'12@#34S','favountcbike’,'bn w'),( l703,'manasvi’,'sre
e','765b43210987’.'F',2t›,’9995550G66'.'nianasvi57 grnail.com’,’guntur','andhra
pmdesh','522004'.’0987hii’,'favourite fJower’,’rose’),

insert into TRAIN{t›ain nu.frain namc,arriva1 tim¢.Jeparturc timc,avoi\cbi1ity où


seats,date) va lues( 1 271 1.'pinatini
cap',’ 1 13000’.' I 14000‘,’A',20l704l0),(123l5,’comiandel
exp'.'1 24500’, l 25000’,’NA’,20170410):

inseo into STATION(flo,ramc,hault,awival time,tmin no)


values( 1 l1,’vijayawad a’.10.' 1 1 3000’,1 27 11 ),(223.'tirupaihi',5,’114500’, 13315);

TRAIN STATUSt main no.w soat8 I.b coats I.b scats2,a scatsl,a scats2.w scats
2,farr1,fare2) values( 127a l. l0,4,O, l. I.0, l00,430),(I 23t5, l0,3.0,0,2,1,300,600),

inseri into TICKET(id.uscr id,status,no of asscngcrs,tr8in no)


values(4001,170l,’C‘, I.,I2?T I ),{4002, 1703.'NC', I ,12315),

in'u•rt into PA 5SCNGERSfpassenger id,pnr no,agegendcr,uscr id,rcscrvation


sIa‹us,scat numbcr,namc.tick¢t id) valucs('i0O|,7ft965,4S.’M', T 70),'C',’B/i-
4S','nimesh',4001),(5002.S4523,S4,'F', t70I ,'W','B3-2I','surckhg',4002);

insert into START$(train no,station no) values( 127 1 1, 1 1 1),(123 1 5,222);

insert into STOPS AT(train nu,station no) values(I 271 1 ,222j,( \ 23l5,T 11);

inscrt into REACHES(tr8in nn,statinn no.time) valuustt27l 1,222.'040000'),


t 123 1 S,I I t,'051500').

insert into BOOKS(user id,id) values(I70l,400l ),(J 702,4002};

insert into CANCEL(user id.id.pessenger id) values(\ 701,400 1 ,s00l ),


T.yrint user id anlt nam¢ of all fhosc user wlto booked ticket Sof pitiakini expmas

select u.nser id,cdncat(u.fint name,u.last name}as name

2.prin\ ‹Jetsisl of pass+ngcn travelling under tick 'I ao 4001

where ticket id like 400l ;


3. display all tltose main no's vhich reach station no --

where t train no-m.train no and r.station not.no and s.name file 'vijayawada';

4. display lime al which t‹ain no----- reaches station no ------

where r.station no-w.no;

fi. ‹display details ofaTl fhosc us¢rs who canclcd wickets fbr train no-----

where c.usor id=1z.uaer id acd c.ids.id and \.train oo like 12711 ;


6. dip1ay the main nu. with increasing urd+r õf lhc Maros of class I

where t

order by hare I asc:

lion passcngw p,train t,úckct tc

where tc.train now.rrain no and tc.ids.ticket id and I.1zain namo like


8. ‹ti play immediate tmin from lirupalhi la V ijayawada

where si.station no xelect no from station where name like ’hrupathi')

and sa.sta1ion no=(aelent no from station where name like 'vijsyawada’)

order by date.

9. display the train no which hsulls for more time in station no--—-----

having max(hault);
10.display details of all those passengers whue status is confirmed for twin no

where t.stetus like 'c' and t.uain ne=I27l1;


Tn our project Railway rczcrya\ion sjrsicm we hew stored all Ihe inTorzneTion about the Trains
schodutcñ and ‹he users booLinlt iiclu'is gnd even steius cF trains, sees ccc This dale bese is
helpful for Ae rlpgTicotions which TociTilole pasaengera to book tile coin tiekc\e and shock be
deceits of ttains and their slalus from ‹heir nl¥ce lull it uvcids inconvinimccs oF yoinj; lo
We had coneid<zod the most inypoztnnl

You might also like