This is a database for tracking buses' lines, stops and trips at Federal District, in Brazil. The scope of this database includes:
- Basic informations about buses, such as license plate, driver and year of fabrication, for example.
- Information about the drivers, such as first and last names.
- Information about bus stops and the number of passengers that have entered the bus during a trip.
- Location of bus stops
- Expected duration of lines' trip.
- Trips, including the starting point and the destination, time duration and length.
This database does not include buses that are not part of the public transport system and information about the passengers of each trip.
A user should be able to:
- Perform CRUD operations
- Retrieve informations about a specific bus
- Check bus stops and destinations
- Check the expected duration of each line trip
- Get the departure, destination and length of each line
- Check the real time taken by a line in a trip
The system will not support permanent deletion of data, since its records must be preserved for future supervisions.
The entities are described as follows:
id
, representing the id of each buslicense_plate
, wich represents the license plate of the busfabrication_year
, that represents the year in wich the bus was fabricatedis_active
, that indicates if the bus is still being used
id
, representing the id of each busexpected_duration
, representing the expected duration in minutes of a trip from the departure location of the line to the final destination of the line (seconds are not considered)destination
, representing the final destination of the linedeparture
, representing the departure location of the linelength
, representing the length of the line,in kilometersis_active
, that indicates if the line is still active
id
, representing the id of each tripbus_id
, representing the id of the bus used in this tripdriver_id
, representing the id of the driver of the tripline_id
, representing the id of the line of this trippassenger_count
, representing the number of passengers that have embarked on the bus during the tripduration
, representing the duration of the trip in minutes (seconds are not considered)departure_datetime
, representing the date and time of departure in the format "YYYY-MM-DD hh:mm:ss"
id
, representing the id of each driverfirst_name
, representing the first name of the driverlast_name
, representing the last name of the driveris_active
, that indicates if the driver is still active
id
, representing the id of the bus stoplocation
, representing the location of the bus stopis_active
, wich indicates whether the bus stop is active or not
id
, representing the id of the line that stops at a specific bus stopline_id
, representing the id of the linebusStop_id
, representing the id of the bus
The diagram of the database is as follows:
In this section you should answer the following questions:
ActiveStops
,ActiveBuses
andActiveLines
views, to filter only active recordsDeleteStops
,DeleteBuses
,DeleteLines
triggers for soft deletion.bus_index
andlines_index
indexes for indexing the most used coluns on theTrips
table.
The database may not represent the location of stops without name, wich makes more difficult to represent the route of a specific line precisely.
The number of passenger that embark and leave the bus at each stop is not represented, as well as their identities.