shipment legs table structure#
An output table for the trip paths of freight shipments including the number of internal trip legs, and the corresponding origin and destination locations of the leg
| Field | Type | NULL allowed | Default Value | Foreign key | Description | 
|---|---|---|---|---|---|
| carrier | INTEGER | NO | 0 | The unique identifier of the carrier | |
| carrier_location | INTEGER | NO | 0 | The location of carrier | |
| shipment | INTEGER | NO | 0 | The unique identifier of this shipment | |
| leg | INTEGER | NO | 0 | The identifier of the internal trip leg for the shipment | |
| truckload | INTEGER | NO | 0 | Unique identifier to be used when a given leg requires multiple truck loads to transport the given volume | |
| leg_type | INTEGER | NO | 0 | The type of the internal trip leg | |
| origin_location | INTEGER | NO | 0 | The trip leg origin location (foreign key to the Location table) | |
| destination_location | INTEGER | NO | 0 | The trip leg destination location (foreign key to the Location table) | |
| truckload_size | NUMERIC | NO | 0 | Size of truckload for a single truck | 
(* - Primary key)
The SQL statement for table and index creation is below.
CREATE TABLE Shipment_Legs (
    "carrier"                    INTEGER NOT NULL DEFAULT 0,
    "carrier_location"           INTEGER NOT NULL DEFAULT 0,
    "shipment"                   INTEGER NOT NULL DEFAULT 0,
    "leg"                        INTEGER NOT NULL DEFAULT 0,
    "truckload"                  INTEGER NOT NULL DEFAULT 0,
    "leg_type"                   INTEGER NOT NULL DEFAULT 0,
    "origin_location"            INTEGER NOT NULL DEFAULT 0,
    "destination_location"       INTEGER NOT NULL DEFAULT 0,
    "truckload_size"             NUMERIC NOT NULL DEFAULT 0
);