location parking table structure

location parking table structure#

This table lists the corresponding parking facility for each location (when available) and the distance to it

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

location

INTEGER

NO

location(location)

Foreign key reference to the location this entry refers to

parking

INTEGER

NO

parking(parking)

Foreign key reference to the parking facility this entry refers to

distance

REAL

YES

The straight distance between this pair of parking and location (meters)

id

INTEGER

YES

The unique identifier of this entry

(* - Primary key)

The SQL statement for table and index creation is below.

create TABLE IF NOT EXISTS "Location_Parking" (
    "location"  INTEGER NOT NULL,
    "parking"  INTEGER NOT NULL,
    "distance"  REAL,
    "id"      INTEGER,

    CONSTRAINT "location_fk" FOREIGN KEY("location") REFERENCES "location"("location") DEFERRABLE INITIALLY DEFERRED,
    CONSTRAINT "parking_fk" FOREIGN KEY("parking") REFERENCES "parking"("parking") DEFERRABLE INITIALLY DEFERRED
);

create INDEX IF NOT EXISTS "loc_parking_idx" ON "Location_Parking" ("location");