0% found this document useful (0 votes)
121 views14 pages

Railwaystationsystem

This document describes a database design for a railway transportation management system. It includes entity relationship diagrams and data dictionaries for tables such as users, tickets, trains, stations, and passengers. Sample data is inserted into some of the tables. Queries are written to create the tables and insert, update, and cancel ticket records. The goal is to efficiently manage the railway reservation system and booking of tickets.

Uploaded by

eimyatpan28
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)
121 views14 pages

Railwaystationsystem

This document describes a database design for a railway transportation management system. It includes entity relationship diagrams and data dictionaries for tables such as users, tickets, trains, stations, and passengers. Sample data is inserted into some of the tables. Queries are written to create the tables and insert, update, and cancel ticket records. The goal is to efficiently manage the railway reservation system and booking of tickets.

Uploaded by

eimyatpan28
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/ 14

University of Computer Studies Yangon(UCSY)

Railway Transportation System Management


Submitted by
YKPT-21336 Ma Ei Myat Pan
YKPT-21490 Ma Aye Myat Kay Khaing
YKPT-21497 Ma Thin Thandar Bo
YKPT-21500 Ma Win Theingi Shwe
YKPT-21478 Ma Chaw Su Hlaing
YKPT-21502 Ma May Myat Noe Aung
Table of Contents

1. Introduction
1.1 Project Description
1.2 Project Objectives

2. Database Design and Schema


2.1 Database Schema
2.2 ER Diagram

3. Query Statement for Railway System


3.1 Data Dictionary
3.2 Create tables
3.3 SQL Statements

4. Conclusion
1. Introduction
1.1 Project Description

This project is about creating the database about Railway Management System.
Nowadays, we use computerizing to store data. It is more efficient. There is a problem in
booking railway system, so we use reservation to solve problem. The railway reservation
system facilitates the passengers to enquire about the trains available on the basis of
source and destination, booking and cancellation of tickets. The ticket once booked can
be cancelled at any time. For this, the passenger has to provide the ticket ID (the unique
key). The ticket ID is searched and the corresponding record is deleted.

1.2 Project Objectives

 Planning the journey comfortably as the process is efficient


 In future, no need to book and can buy with E-Ticket
 Ensure to improve transportation efficiency
 Can buy ticket by another people instead of passengers
 If there is an error, we can check and find out easily data because we save
in computer
2. Database Design and Schema
2.1 Database Schema

user( user_id, name, gender, age, mobile_no, email, city, state, pincode, password)
train( train_no, train_name, arrival_time, depature_time, availability_of_seats,
date)
station( station_no, name, hault, arrival_time, train_no)
train_status( train_no, b_seats1, b_seats2, a_seats1, a_seats2, w_seats1, w_seats2,
fare1, fare2)
ticket( ticket_id, user_id, status, no_of_passengers, train_no)
passenger( passenger_id, pnr_no, age, gender, user_id, reservation_status,
seat_number, name)
starts( train_no, station_no)
stops_at( train_no, station_no)
reaches( train_no, station_no, time)
books(user_id, ticket_id)
cancel(user_id, ticket_id, passenger_id)
2.2 ER Diagram
3. Query Statements for Railway System
3.1 Data Dictionary

Title Attribute Type Format Required PK/FK FK


Reference
s
User user_id integer YES PK
name varchar YES
gender varchar YES
age integer YES
mobile_no varchar YES
email varchar YES
city varchar
state varchar
pincode varchar YES
password varchar YES
train train_no integer YES PK
train_name varchar YES
arrival_time time YES
depature_time time YES
availability_of_ char YES
seats
date date YES
station station_no integer YES PK
name varchar YES
hault integer YES
arrival_time time YES
train_no integer YES FK train
train_statu train_no integer YES PK
s b_seats1 integer
b_seats2 integer
a_seats1 integer
a_seats2 integer
w_seats1 integer
w_seats2 integer
fare1 numeric YES
fare2 numeric YES
ticket ticket_id integer YES PK
user_id integer YES FK user
status char
no_of_passengers integer
train_no integer YES FK train
passenger passenger_id integer YES PK
pnr_no integer YES
age integer YES
gender varchar YES
user_id integer YES FK user
reservation_status char
seat_number varchar
name varchar YES
starts train_no integer YES PK/FK train
station no integer YES FK station
stops_at train_no integer YES FK train
station no integer YES FK station
reaches train_no integer YES FK train
station no integer YES FK station
time time YES
user id integer YES
ticket_id integer YES
passenger_id integer YES
books user_id integer YES FK user
ticket_id integer YES FK ticket
cancel user_id integer YES FK user
ticket_id integer YES FK ticket
passenger_id integer YES FK passenger
3.2 Create Table
User
user_i name gende ag mobile_n email city state pincod password
d r e o e
1701 PanPan F 18 09334555 [email protected] ygn ygn 123456 pan222*
1702 AyeAye F 20 09223435 [email protected] mdy mdy 123428 aye!534
1703 Jhon M 33 09445676 [email protected] Londo Englan 111234 jhon33$
m n d
1704 ParkYoo F 24 09955449 [email protected] Seoul Korea 985766 yoon667*
n m &
1705 Byul F 36 09434567 [email protected] French French 280402 |
m byul28#@

Passenger
passenger_i pnr_no ag gender user_id reservation seat name
d e status numbe
r
5001 2842 18 F 1701 C B645 PanPan
5002 2843 20 F 1702 B A123 AyeAye
5003 2844 33 M 1703 C A124 Jhon
5004 2845 36 F 1704 A W223 Byul
5005 2841 24 F 1705 A B223 ParkYoon

Station
station_no name hault arrival_time train_no
1111 Park 10 10:00:20 4001
1112 Jopp 12 10:00:20 4001
1113 Rail 11 11:00:20 4002
1114 Kelvin 13 09:05:40 4003
1115 Kate 14 12:10:20 4004

Ticket
ticket_id user_id status no_of_passengers train_no
1211 1701 C 1 4002
1212 1702 A 1 4003
1213 1703 AB 4 4001
1214 1704 F 3 4002
1215 1705 D 4 4001
train_no train_name arrival_time depature_tim availability_of_seats date
e
4001 Jackie 10:00:20 10:20:20 A 2020-3-21
4002 Rose 11:00:20 11:20:20 B 2020-3-22
4003 Jennie 09:05:40 09:25:40 NA 2020-3-23
4004 Lowis 12:10:20 12:30:20 W 2020-3-24
4005 May 09:55:22 10:15:22 A 2020-3-25
Train

Cancel
user_id ticket_id passenger_id
1701 1211 5001
1702 1213 5005
1703 1212 5004
1704 1214 5002
1701 1215 5003

Books

user_id ticket_id
1701 1211
1702 1213
1703 1215
1704 1214
1705 1212
Train status
train_no b_seats1 b_seats a_seats1 a_seats2 w_seats1 w_seats2 fare1 fare2
2
4001 10 11 2 3 22 23 20.000 12.220
4002 12 13 4 5 24 25 90.000 33.340
4003 14 15 6 7 26 27 90.000 90.000
4004 20 21 9 10 28 29 70.110 88.000
4005 9 1 32 22 31 30 67.777 99.000
Reaches

train_no station_no time


4001 1111 00:40:00
4002 1112 01:40:00
4003 1115 08:55:00
4004 1114 00:40:00
4005 1113 13:20:00

Starts

train_no station_no
4001 1111
4003 1112
4002 1113
4005 1114
4004 1115

Stops_at

train_no station_no
4001 1111
4002 1114
4003 1112
4004 1113
4005 1115
3.3 SQL Statements

(1) find user id and name of all those user who booked ticket for 'Jackie'

select u.user_id,u.name
from user u,train t,ticket tc
where u.user_id=tc.user_id and t.train_no=tc.train_no and t.train_name ='Jackie';

user_id name
1703 Jhon
1705 Byul

(2)find details of male passengers over age 20.

select *from passenger


where age>20 and gender=’M’;

passenger_id pnr_no age gender user_id reservation_statu seat_number name


s
5003 2844 33 M 1703 C A124 Jhon

3)display the name of train which reach 'Park' station

select train_name from train t,station s,reaches r


where t.train_no=r.train_no and r.station_no=s.station_no and s.name='Park';

train_name

Jackie
4)Dispaly time and station name at which each train reaches
select r.*,s.name from reaches r,station s
where r.station_no=s.station_no;

train_no station_no time name


4001 1111 00:40:00 Park
4002 1112 01:40:00 Jopp
4005 1113 13:20:00 Rail
4004 1114 00:40:00 Kelvin
4003 1115 08:55:00 Kate

5)Display all datails of users who canceled tickets for train no '4002';

select u.* from user u,cancel c, ticket t


where c.user_id=u.user_id and c.ticket_id=t.ticket_id and t.train_no='4002';
User name Gender age Mobile_no email city State Pincode Pas
id
1701 PanPan F 18 09334555 [email protected] ygn ygn 123456 Pan

1704 ParkYoon F 24 09955449 [email protected] Seoul Korea 985766 Yoo

6)Give 5% raise to fare1 of all train

update train_status set fare1=fare1*1.05;


select*from train_status;

Train_n b_seats1 b_seats2 a_seats1 a_seats2 w_seats1 w_seats fare1 fare2


o 2
4001 10 11 2 3 22 23 21.000 12.220
4002 12 13 4 5 24 25 94.500 33.340
4003 14 15 6 7 26 27 94.500 90.000
4004 20 21 9 10 28 29 73.616 88.000
4005 9 1 32 22 31 30 71.166 99.000
7)Delete the data of booking people which have user_id='1702'

delete from books where user_id='1702';


select*from books;
user_id ticket_id
1701 1211
1703 1215
1704 1214
1705 1212

8)Find the nunmber of female passengers.

select count(*) from passenger


where gender='F';
count(*)
4

9)Find the total fare of seat 2 in train_status;

select sum(fare2) as Total_fare2 from train_status;


Total_fare2
322.560

10)Find the average fare of seat 2 with the name as 'Average_fare2'.

select avg(fare2) as Average_fare2 from train_status;

Average_fare2
64.5120000
4. Conclusion

The project development was really a very enriching and informative experiences for us.
The making of the project has enhanced our practical knowledge and our teamwork skill
improved. The project is the outcomes of our continual teamwork. We are the fresher so we have
weakness and we try to fulfill our skill.

You might also like