Skip to content

Commit afdce8e

Browse files
authored
Add files via upload
1 parent 3578460 commit afdce8e

File tree

2 files changed

+77
-0
lines changed

2 files changed

+77
-0
lines changed

01.Building_BRT_Database.sql

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
/* BRT is a public transport for the people of Peshawar, Pakistan. In this Project I created database, which will help BRT managment
2+
to record the data, and in future after analysis BRT can save and earn millions of ruppes(pkr). Further it can provide satisfiction
3+
to it's customer. It can also track the records of it's employee work. */
4+
5+
6+
7+
drop database if exists BRT; -- to ignore error
8+
create database BRT; -- create database
9+
use BRT; -- select brt database
10+
11+
12+
drop table if exists bus_info; -- to ignore error
13+
create table bus_info -- this table contain information about BUS
14+
(
15+
bus_id varchar(16) unique not null, -- every unique bus has their own route
16+
initial_stop varchar(32), -- the 1st stop of bus
17+
final_stop varchar(32), -- final destination of bus
18+
start_time DATE, -- time when bus started
19+
reach_time Date, -- time at bus reach it's final destination
20+
route_line int, -- every bus has it's own route
21+
route_type varchar(10), -- there are two type of route main route and feeder route
22+
primary key (bus_id)
23+
);
24+
25+
26+
drop table if exists rider_info;
27+
create table rider_info -- this table contain info about customer
28+
(
29+
rider_id int unique not null, -- rider have unique number
30+
type varchar(8), -- ride type are either casual or membership
31+
Gender varchar(8),
32+
primary key (rider_id)
33+
);
34+
35+
36+
drop table if exists Driver_info;
37+
create table Driver_info -- this table conatain info about driver
38+
(
39+
driver_id int, -- every driver has it's own unique number
40+
first_name varchar(16),
41+
last_name varchar(16),
42+
age int,
43+
gender varchar(8),
44+
contact_numeber int,
45+
email varchar(32),
46+
primary key (driver_id)
47+
);
48+
49+
50+
drop table if exists Ride;
51+
create table Ride -- this table contain how customer use BRT
52+
(
53+
bus_id varchar(32) not null,
54+
driver_id int,
55+
rider_id int,
56+
on_station varchar (32), -- station at which customer start it's ride
57+
off_station varchar (32), -- station at which customer end it's ride
58+
on_time datetime, -- when customer enter the station
59+
off_time datetime, -- when customer out from the station
60+
foreign key (bus_id) references bus_info(bus_id), -- connecting tables ride and bus_info
61+
foreign key (rider_id) references rider_info(rider_id), -- connectine tables ride and rider_info
62+
foreign key (driver_id) references driver_info(driver_id) -- connecting tables ride and driver_info
63+
);
64+
65+
66+
67+
drop table if exists route_info;
68+
create table route_info -- this table contain which stations names exists on each route.
69+
(
70+
bus_id varchar(16), -- this will be repeated many times here.
71+
station_name varchar(32), -- stations names
72+
foreign key (bus_id) references bus_info(bus_id)
73+
);
74+
75+
76+
77+

01.Building_BRT_Database_schema.mwb

9.85 KB
Binary file not shown.

0 commit comments

Comments
 (0)