Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: How to store the bus route in the database ?

Re: How to store the bus route in the database ?

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 18 Oct 2002 15:12:45 -0700
Message-ID: <c0d87ec0.0210181412.9869c32@posting.google.com>


>> 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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US