-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitTable.sql
More file actions
42 lines (40 loc) · 1 KB
/
initTable.sql
File metadata and controls
42 lines (40 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
CREATE TABLE IF NOT EXISTS Routes (
ServiceNo TEXT,
Operator TEXT,
Direction INTEGER,
StopSequence INTEGER,
BusStopCode TEXT,
Distance REAL,
WD_FirstBus TEXT,
WD_LastBus TEXT,
SAT_FirstBus TEXT,
SAT_LastBus TEXT,
SUN_FirstBus TEXT,
SUN_LastBus TEXT,
FOREIGN KEY(BusStopCode) REFERENCES Stops(BusStopCode),
FOREIGN KEY(ServiceNo) REFERENCES Services(ServiceNo),
FOREIGN KEY(Direction) REFERENCES Services(Direction),
PRIMARY KEY(ServiceNo, Direction, StopSequence)
);
CREATE TABLE IF NOT EXISTS Services (
ServiceNo TEXT,
Operator TEXT,
Direction INTEGER,
Category TEXT,
OriginCode TEXT,
DestinationCode TEXT,
AM_Peak_Freq TEXT,
AM_Offpeak_Freq TEXT,
PM_Peak_Freq TEXT,
PM_Offpeak_Freq TEXT,
LoopDesc TEXT,
PRIMARY KEY(ServiceNo, Direction)
);
CREATE TABLE IF NOT EXISTS Stops (
BusStopCode TEXT,
RoadName TEXT,
"Description" TEXT,
Latitude TEXT,
Longitude TEXT,
PRIMARY KEY(BusStopCode)
);