| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: How to store the bus route in the database ?
>> I have no idea how to store the information of different routes, <<
Here is one possible way:
CREATE TABLE Routes
(route_nbr INTEGER NOT NULL,
stop_nbr INTEGER NOT NULL,
day_of_week CHAR(3) NOT NULL CHECK (day_of_week) IN (...)),
stop_location INTEGER NOT NULL
REFERENCES BusStops(stop_location),
arrival_time TIME NOT NULL, -- might not be available in your DB
...,
PRIMARY KEY (route_nbr, stop_nbr, day_of_week));
The data would look like this:
(666, 1, 'Fifth and Main St', 'tue', 12:00); <== start of day's work
(666, 2, 'Main St and Gordon', 'tue', 12:10);
(666, 3, 'Gordon and Bradly', 'tue', 12:30);
(666, 4, 'Bradley and Fifth', 'tue', 12:40);
(666, 5, 'Fifth and Main St', 'tue', 12:50); <== second loop
(666, 6, 'Main St and Gordon', 'tue', 13:00);
....
Received on Fri Oct 18 2002 - 17:12:45 CDT
![]() |
![]() |