You are on page 1of 33
Database and Web Database | a =< STAFFORDSHIRE UNIVERSITY Sa APIIT SD INDIA CE00318-2 (DWDS) Database and Web Database Systems INDIVIDUAL ASSIGNMENT ONLINE RAILWAY RESERVATION SYSTEM ‘ecdn.com. Database and Web Database System Table of Contents 1. INTRODUCTION... 2. PROPOSED SOLUTION. 3. Ey Relationship agra 2A UstOFEniy types... 2 isto Relationships 3.3 Entity Relationship Diagram: ‘A. Mapping of RO to Reltiona Model. 5. ormatuaton, Init Database Schema... 5.1 FIRST NORMAL FORMAN)... 5.2 SECOND NORMAL FORM (2 5.2 RELATIONS IN THIRD NORAL FORM (24. 6. TABLE DESIGN & STRUCTURE... J QUERIES none 7:1 001, STATEMENTS... 7.2.DM. STATEMENTS. 8 FORMOISION. 8. REPORTS ssn 10. TOMAR, ms 1L__REFERENCESANO CITATION. 1.INTRODUCTION ‘This system is haseally concerned withthe reservation and cancelation of railway lickets to the passenger, The need ofthis system arouse because as isthe known fact that India has the largest railway nawork in tke whole world and it isnot possible co handle such a large system yanuatly By computerizing it, became possible 40 overcome the limitations and make the system ‘operations more effiient, Thecomplexity in handling data and records of such a vast system got reduced and became easier by compuserizing Being move specific, this enlie railway reservation system can perform We basic functions like reservation and cancelation, The users are required tegster cn the server for getting access to Ue database and query result retiieal Upon registration completion, Which is essentially refered to as the “view level” of the customer, The account contains comprehensive infomation of the user entered during the registration and allows the wser to access their past reservations, cancellations, enquire about trains and tain schedule, seat vallaility and mabe aftesh reservations, The wer will also be able pda helt account enalls ete ‘The master user of is ayatem is the Railway Administrtor who can login using a maser password and ence a user is auihenticaed as the admin, he/she can acess and modify stored in the database of this sysiem, This includes adding and updating of train, outes and also managing the wser and the passenger details informati station, tai 2. PROPOSED SOLUTION ‘The railway network i a vety vast system tobe handlad manually aad is computerization wil prove to be of great help to both the employees and the passengers. The customer and the admin fe the two partes which are allowed to have access 10 the database of the system and have different view level schemas’ to he database information, ‘The customers ae privileged with the following services: ‘+ Reginerasa customer by providing cenaa personal duis ‘Make freshest vations and hock one or more (limited 3 seats per icke) sat 1+ View pas booking at ean even docatccllation of booked ticket. ‘+See mains between a pai of stations, check seat availabilty in tains and get the fre dai, ‘© Login as tue master wer using a master password ‘© Addirain, station, and route ‘© Sse userand passenger details mid can even delete theit profiles ster which the use will tot be able to login tothe system as a user ‘The system's security has been kept imo consideration wel. The database ef the system cannot bbe accensed by any user either admin or customer without being authenticated by coneet ‘username and passwort, The password set cam also be modited and in cae ithe user forgets the password, itcan be recovered by giving a correct answerto a secuity question 3.1 List of Entity types: Entity Attributes: 7 | Traix_Siaus ‘Avalable Date, Booked_seatsl, Waiting seatsl, ‘Avilable sets, Booked seat2, Waiting. sat, ‘Avalatle seats2 Booked, seas3, Waiting_seat, Avalatle seais3 3.2 List of Relationships: Sino._[ Relation Type Entity Types Tnvalved Database and Web Database System 3.3 Entity Relationship Diagram: _yavapase ana wen spauapave system, 4.Mapping of ERD to Relational Model ‘Step I: Mapping of Strong Entity Type ‘Sao [Entity Type Passenger | Passenger (PNR Gener, Passeage_name. Age Booked By) ‘Sation (Suton 1D, Staton_name, ‘Step 2: Mapping of Weak Entity Type: ‘Sino_[Eniity Type _| Relation 2 [Trdnstus | Trais_suus(Tiain ID, Available Date, Booted seast. Waiting_seats]_ Available_seats1, Booked_seats2, Waiting_ seats? Available seat. Booked seals3, Waiting_seats3. Avalale, seat) ‘Step 2: Mapping Of 1: Relation _| Entities ‘Approach | Relation Endsat | Train, Staton | Foreign Key | Train(Tiain_ID.Train_nameDays_avallable, ‘Train type Fare_classl. Fare class2 Fare cliss3, Seats class], Seas. class2, ‘Seats classi) Ea Foreign Key | Passenger (PNR, Seal number, Class. Name, ‘Age, Gender, Fare, Destination. ID) Step 3: Mapping Of M:N Relationship: s. Normalization Initial Database Schema Name Passwon Securiy_quastion | Seouiy_answer Tr ‘Seats_class2 ace als ‘valle aye {_ Sait T + Passenger PNR | Passenger_name | Gender as no | Glass | Fare | Source w % Route __—————————————— |—o{ TaiicID | Stopcimnnar [Source aitunee [Ava | Depaieomn ] # Train -——.|O. Train 1D ‘Ruailabe Date | Booked | Booked | Booted | Waiting sear —|scarz [seats | seat Wailing sea | Waiting satcd Availabe | Available | Available mst | ecatsd | seated ‘Consist_of ‘Station ID ‘Siop_nismber seat sea? | seat | seat Waking said | Waking scans [Availabe | Avallatie [Avaliable | _seatst | seats? | seus 7 a Tevet [treba | 5.1 FIRST NORMAL FORM(LNF) Relations already in INF TRAIN & —— Paseenger.sicket EAR] Gass Type | Fare | Source ID] Destination 1D —-Passenger-ticket R PNR] Claw Type | Fare | Source ID | Destination 1D Passenger TAR | Sclmumber | Pasenger mame | Age ° Gender ‘© (CRAIN after INF Train days ‘Train D [Days Available Tain Fare_lise3 Seuts_dasd 5.2 SECOND NORMAL FORM (2NF) RELATIONS IN2NF [Mraimetass 5.3 RELATIONS IN THIRD NORMAL FORM (3NE) RELATIONS IN NF [Station [aim stats 00 | Reservation 6. TABLE DESIGN & STRUCTURE Data Type Allow Nults int a Train name vercharts0) o Train.type vvarchar(S0) a Source stn varchar(30) wv Destination.stn ‘varchar(20) a Source 10 varchar) wu Destination ID varchar(8) w o Date Type Column Name in tO int in_neme vorehar(s0) f Train type varchari50) t Source_stn varchar(30) w@ Destination str verehar(30) 7 Source JD varchari@) 7 Destination 10 varchar) @ » t ‘CONSTRAINTS: ‘PRIMARY KEY. Train 1D. 3)_DAYS_AVAILABLE Column Name Data Type Allow Nulls i int 5 @ Avoilable deys varcher(20) 5 STATION Column Name Date Type Allow Nulls » Ea varchar(8) 5 Station Neme vverchar(30) o Ho ‘CONSTREATN PRIMARY REY: Staton FOREIGN KE 3) PASSENGER ‘dbo Passenger: Tabi. aqlexpress Railway) > ‘Colurin Name Data Type Allow Nuts >? PNR varchar(25) Lai} © Sest_number int a Passenger_name verchar(20) a Age wt oa Gender verchar(8) 5 Train ID int a Booked By varcher(30) w a [FOREIGN KEY. Tain 1D 5 PAGTNGER TICKET Column Name i Source_D Dettination JO Class type Reservation statue Train ID Booked By Data Type varchar(25) varchar(8) ) varchar(50) varchar(25) int varchar(30) varchar Allow Nulls: i PNR «FOREIGN KEY: Tain ID Database and Web Database System 7) TRAIN STATUS ‘CONSTRAINTS: ‘Column Name Data Type » i int Available ate varchar) Booked seats int Booked zeats2 int Available seats oe ‘¢_ PRIMARY KEY: Train ID, Available Date «FOREIGN EY: Tain 1D Allow Nulls n w mw w a @ i) ™ @ w Column Name Data Type Allow Nulls: ii int ® Stop_number int Station ID varchar@) Acrival.time tet Departure time tet ‘Source distance Data Type » i int o @ Station ID varchar(8) o ‘Stop_number int a ‘+ FOREIGNKEY: Station 1D 1) USER Column Name Date Type Allow Null ~ co varchar(30) 5 Password varcher(15) 5 FullName varchar@0) 5 Gender varchari8) 5 Age int a Mobile varchar) a City varchar(20) ci State varchar25) a Security.question varchar(40) a Security.answer varchar 20) a ‘CONSTRAINTS: ‘© PRIMARY KEY: EmallD FOREIGN KEY: TH) ADMIN ‘Column Name Data Type Allow Nulls »~ varchar(20) 5 Password varchar(15) o 8 ‘+ PRIMARY KEY: UseeID FOREIGN KEY: 1) RESERVATION Column Name Data Type Allow Nulls ~ int 5 F Avsilable Oote vvarchar(20) a F EmaillD varchar(30) 5 @ PNR varchar(20) a Reservation Date tet 5 Reservation Status varchar(20) 7 7.1 DDL.STATEMENTS TD tnt pa wall, Tiain_name vaichar30) wot wall, Trappe ‘archar(50) not mul, Source, stn Varchar(90) nul, Destinavon sta varchar(30) null, Souree, 1D ‘varchar(#) nell, Deaination_1D varchay(8) null, yrinary keyCTrain_ID), foreign key(Source_ 1D) references Station(Sutien ID) on update cascade on dalete cascade, foreign key (Destination ID) references Staion( Station ID) on update wo setion on delet» no sstion) 2) TRAIN CLASS. so ern cor WTR RTT Create tae Train_class (Tral_ID tat not aul Fare_ClissT int not nal, Seal Class wt not nal, Fare Class2 int not nll, Seat_Class2 int not null Fare_Class3 int not null, Seat Class int not ull, primary key(Prain_1D)) YS_AVAN Greate” table Days_Available(T key(Train_1D)) DD nok mall, Available days varchar 20) primary (a StxtION | Create wble Station(Siaiton_ID int not null, Station_Name varchar(25), primary key( Station ID) b (oS PASSENGER} ‘etcate Table Passenger CPN varchar) not mil, Seat int wot auld Passenger vam | | Vatehar(O) mot mull, Age int not null, Gender varchar) not null, ‘Train_ID int not mul foreign kkey(Train_ID) references ‘Train(Train_ID) on update cascade on delte cascade, primary eyiPNR, Seat_numben ) 6) PASSENGER TICKET ‘reste table Passenger ticket (PNR warchart23) not aull, Source ID varchar(®) not hull, Destination ID yarchay(8) not ull, Class_type varchar(S0) not null, Reservation_siatus varchas(25) not mull, Train_ID int not null foreign key(Train ID) references Trait Tisin ID) on sapdte caseado on delete eaicade, primary key(PNR) ) 7) RESERVATION freate able Reservation (Train ID int not aull Available Date vachar20) not null, EmaillD varchar(30) not null, PNR varchar20) not null, Reservation Dale text not ull Reservation Stats varchar(20) null, foreign key(Train_ID,Available Date) references ‘Train_statust (Train ID.Available Date) on uplae cascade on dete cascade, foreign ey(EmaillD) references User table(EmaillD) on uplate cascade on delete cascade, primary {ey(Train_ID Available Date,EmaillD PNR) ) 3) TRAIN STATUS reste table Train.staus? (iran ID iat wat wll. Avaiable_Date varchav(20) not ull Booked seats} key(Train_ID.Availsble Date), foreign key(Train ID) references ‘Trin(Train_ID) on update cascade on delete cascade) tll, Waiting sests3 int null, Available sests3 int null, primary 9 ROUTE. ‘Greate lable Rovie (Irain JD ft not null, Stop muir int not wall, Station_ID varchar) wot wut. tiv hull, Departure time Lest not ull, Sourse distance ia 10 null, primary key(Train_1D,Stop_number), foreign key(Tiain ID) references Train(Train_ ID) on update cascade on delete eascade) 10) ROUTE HAS STATION rete Table Route HAS Staion CTran_ID int not wull Station ID varchar20) not null, ‘Stop_number int not mull, primary key(Train ID, Station 1D)) Ti) USER Greate table User tale (Email varchar(30) not null Password vachar(I5) not null PullNane ‘varchaa(30) not null, Gender varchar(8) not null, Age int net mull, Mobile varchar(14) not null City varchar(20) not null, Stte varchax25) not mull, Secwity_question varchar(40) not null, Secutity_ answer varetit(20) not null) 12) ADMIN ‘Greate table Admin table (User 1D varehar@0) not nul, Password varchas(15) not nll, pimary tey(Uer ID) 7.2 DML STATEMENTS INSERT STATEMENTS ‘Adding a new Station — Thir step & wed w add a now station to the station table whore the admin provides the station name and the station id by which it willbe recognized. insert into Station values(” +txt id Tent +". +00 name Test + Adding a Route = Datais inserted ino the Route table, ‘Table roate toe the source distance. centres of tain i stop mumer, sation id, arrival time, departure time and Mxt_stnid Test {+o swopnoText +" + 0xt_arivalText 4." 4 tet dapanure Text +" + et ditance Tout 4") Update Station update Staion st tation ID=* + txt id Text +” where Station_name="+ tet_name. Text + Update Train update Tain ser Train name=" tx_tainmane TRU "Type ‘ddl_typeSelectedliem + "Source stn=" + ddl, source Seleceditem +", Destinaion_sin=" + dll destSelectadfiem +" where Train ID="+txt_uainid’Text ¢* RESERVATION + Res dation Sion ble and gt Sows Staion ID salconming ond» oe Se coma dal source Selectedtiem TeStringt) + eet" Hom Station where Station_name =” + ent) Selowesmondor de = ead ExdeuteRender()} vate (dr.tead() ‘ {sid Text = dif Station 1D") To Sing): > #010 + Read data rom Staion able and get Desinaton Staten 1D atCommans end = now Setconmind(' dl dest Selecteden-ToStingt) 4°", oni): Squbattender de = ond Eageutehender() vate (érstead()) 11 * from Station where Station name =" 4 {at dideText =a ation ID"-ToSring ) er c10%e()5 + Calis of tains aah : panaLatuaion Select Route.Train_ID, Tran. Traia_mame Train_status.Available_Date FROM Route INNER JOIN Tis ON Route-Train ID=Thain Train 1D INNERJOIN. Trin states ON Train-Train ID=Prain status Train ID WHERE (Reute Station ID IN (SELECT Source Station ID FROM Rotle AS Source INNER JOIN Route AS Destination ON Sourse:Train_ID = Desination Train 1D. WHERE (Source Stop_aumber - Desintion Stop_number <0) AND (Source Sttion_ID = @Souree) AND (Destination Ststion_ID = @Det))) AND Crain_stus.Available_Date = @ Avalate Date) + Get sca status from table Train_status and display it when user selects the class from sdopsownlist provided Saxconsane ena = nen Soiconmnar"Seect * from Train_staus where Train_ID ="-+ WL id-Tex. ToSteing) + "and Available Dac=" 4 txt date-Text +", cont); ‘Silbetatescer dr = end. txecuteBeader(); ete (ersReadt)) « {b seats-Text = di{*Available seats1"I ToSting0: Label? Test = "Total available seats in “bl class Text +" ae: " IbL_msg. Text = "Total Seats already booked: WL booked. Text = ei"Booked seats!" ToString0, or.ci9se3 ‘© Calculate Fae form the Joumey distance from the selected source aad destination Salons Saicamand t tou Salcomani("Seleet # from Route where Traia_ID =" + IDL idTemt ToSting) + "andStation ID=" + wt sid Text + Ssqstahenier dra = K-ExecuteResder();, venite (arts teadt)) ‘ distance Test = dr2["Source distance") TeString)); ) erncaeees Selcoomand Kk » ew Sqicomand(*Selest* from Route where Train_I WL idText-ToSting() +" andStation ID=" + xt didText +", ken); Sgloataiuaer or = Res GerestetewierOi PTIOGLIS6- Individual Assignment Paez ile (EH. teROT t }Source_ distance") ToString(); distance2. Text = a3 > a.close0; int atstance = (esniert, Younen2(asstance2. text) ~ Convers, Tountaz(atetanced. text) )5 ‘Sqlcomand end = neu SoiCamana"Select* from Train_class where Train ID =" + ILd:Text ToString) +", cont); sqlbetatenier dr = endstaccuteRender (5 vse (ér.teat() ¢ tL XTex 3 int Y =Con ver Foln3240b1_X.Text int faye = ¥ ® Convex Totat32(dell seats-Text)*distance : -Fare_Class1"}Tostring): + After Farecalculstion, ald passengers details to prosess ee 9 + Convert Tote 32(292_seots Text); nt beoked = Convers ToIneS2(1b1 booked Text); wert Passeager valies™ + par + "4044 ++ ddl gender] Selecedltem +." + 1b id Text + ee ‘txt_pmame Texts "4 txtagel Text + IDL email Text + "7" com) 5 ed bxccutetoguery0s CANCELLATION QUERIES ‘update Passenger ticket set Resevation_status = CANCELLED’ where PNR=" txt_PNR Test ‘+ With the cancellation of oneticked availble seas in Thain stats table for hat specific tain sheuld increase and booked seats should decrease by | ‘update sin_status set Aviilable_seatsl=Available_seabl-+1 aid Booked seats Booked seaist-1 where Train, ID="sIbl sl Textt™ and Available Date—"+1b_ date Text 8.FORM DESIGN 1) NEWREGISTRATION~ USER being provided should net violate the validation rules eftervise registration will net be allowed. 3) LOGIN PAGE ADMIN, USER TS Indian Raiways | ONLINE 0. DESCRIPTION: Kegsteted uses login tothe website By usng aspeciic EMAlID and passwort, This will rditect the user to a diferent view level where the user wil be availed Aatious service like weservition, cancellation et 3) ADD TRAIN DESCRIPTION; Adinin of this website can add new trains tothe daiabase which will be further allowed for reservations, Tain wil be assigned a Tan ID which should e unique and then a ‘vain name will also be assigned tothe train for ils identification, FADD STATION DESCRIPTION: The adminis privileged to add.and update new stations and sation IDsto the _ystem’s databace, 3) ADD ROUTE ROUTES DESCRIPTION: Already added rains equite aroute tobe defined which ithasto follow. The admin can use this page to at new route tothe train where hese has todd station ids and stop ‘numbers along with anival aud departure tines, 6) TRAIN STATUS ry sano TRAIN STATUS ee TD = DESCRIPTION: Thic page canbe ussd to xeethe total available eats, booked coats and waiting seals in panicular classes ofa train, The Vain IDs is avilable inthe dropdown list given, 7) MANAGE PROFILES DESCRIPTION: Admin can view the detals of teghtoved users and ean also ups and debts Uwir accounts, Users whose account will be dled won't be able 10 use the reservation ‘cancelation services of the ste 3) MANAGE TRANS Indian Railways | ONLINE HOME TRAINS ADDSTATIONS MANAGE PROFILES MANAGE TRAINS ———————— DESCRIPTION: Admin can view and update tain deals that lave been added 10 the database of this system ‘The admin can find tains ether by providing trainidor wain name 9) CHECK PNR DESCRIPTION: Users who have reserved seats in any of the (rains can enter the PNK number Provided to them and can see the status of their ticket whether itis confirm, is cancelled or is ‘queued inthe waiting slow. 10) SEAT AVAILABILITY DESCRIPTION: Thisis ased 0 view the available seals ina particular class of a ai User eat center the source and desinatien station name and the date for which they want to see the availabilty of seat Th) VIEW SCHEDULE DESCRIPTION: Users can search and view tain schedule and other details by proving the tain ‘number othe tain name, The wser will be shown the train details like srval departure timings ‘along wih the route it will follow to reschto the desinstion station. 9.REPORTS Description: ‘The report TRAINS is use to show the list Tans added by he admin to the database. This ‘consists ofthe trai i, tsi name, tain type, source ation name, and destination station name. "This report can be downloaded in ether of pat form or docs form or as an excel sheet. ‘Admin weeds to see the detailed list ofthe trains ike the train wane, is source tation and the destination station, The report abo shows thetype of train it isi.e, whether itis an express tain ‘¢ super fast Rajdhani et, This report will help in the management of trains tothe admin, 2) REPORT: TRAIN ROUTE “The report TRAIN ROUTE displays details ofthe routetha trains ofthis website will follow. It conssts ofthe train i, station id Where he train Will top, stop number, zival time a the stop, ‘departure time from the stop andthe distaece ofthe stop from the source Staton ‘When the useriadmin) will w tose the the detailed list of tains along wit its stop stains and its timings at al ts tops from source 1o destination, this report. wil be helpful so that by ‘viewing this report any requited changesfmodifications ean easily be mie tothe database. 10. TOOLBAR ‘A toolbar fas been provided in the wer's view level which consists ofieons ike Home, Tain, — ‘at Ticket which serves aa link totherewecive pages. The Home iconif clicked redinets the ‘user the Home page ofthe user and similarly the Power button icon allows uso « propor logout. Tiss the Schedule icon which takes the user tothe “Chesk This icondepictsthe Schedule” page Home. On clickef tis, wer b redirected tots homepage. Tiss the Ticket con on clekof which takes the user tothe "CheckSchedule” page where the wser wilbe ableto reserve 1 ar more seats inany parila tala The wer anlogeutof the webste by dling this “The train icon redirects the usoe to the search tain page uhichallows userto seach diffrent tains by enteringthe tranid orthetrah nemeor even by enteringany rout tation. 11. REFERENCES AND CITATION 1) SOLJOINS wieschoolsadmin, (2013). SQL INNER JOIN. Available: hup//www.w3 schools convsqlisql_join_inner.asp. Last accessed 24th April 2013. 2) SQL LEFT JOIN w3eschoolsadmia, (2013). SQL LEFT JOIN, Available: hhupy/ www.w3schools convsqlisql_teft_innerasp, Last accessed 21st April 2013. 3) 8 E wieschoolsadmin, (2013) SQL UPDATE. Available: hupe/ www. waschools convsqllsql_update asp. Last accessed Sth April 2013, 4) INSERT STATEMENTS IN SQL BY Cit ‘mare. (20 12). write insert query in c#. Available: Ihup/stackoverflo w.convgquestions/9954900/how-to-write-insert-query-in-e. Last accessed 21st April 2013. 5) GRIDVIEW DATABINDING Msoft, 2013). Grid View.DataBind Method. Available: bhuip/msdn.microsoft.comven-IN/library/tkxOcyéd asp. Last accessed 12th April 2013. FOREGIN KEY CONSTRAINT ‘wieschoolsadmin, 2013). SOL FOREIGN KEY Constraint, Available: btip:/ www. w3schools comv/sqlsql_foreignkey.asp. Last accessed 18th April 6 7) Referred 10 wwawinsionraligou in) and we irct.co.in

You might also like