ev charging station plugs table structure

ev charging station plugs table structure#

Lists number and type of plugs available at each electric vehicle charging station

Not required by all models.

Table Structure#

Field

Type

NULL allowed

Default Value

Foreign key

Description

station_id

INTEGER

NO

EV_Charging_Stations(station_id)

Foreign key reference to the electric vehicle charging station defined in the EV_Charging_Station table

plug_type

INTEGER

NO

EV_Charging_Station_Plug_Types(plug_type)

Foreign key reference to the type of plug as available in the EV_Charging_Station_Plug_Types table

plug_count

INTEGER

YES

0

Number of plugs of specified type found at specified electric vehicle charging station

(* - Primary key)

The SQL statement for table and index creation is below.

CREATE TABLE IF NOT EXISTS "EV_Charging_Station_Plugs"(
    station_id INTEGER NOT NULL,
    plug_type  INTEGER NOT NULL,
    plug_count INTEGER DEFAULT 0,

    CONSTRAINT "fk_stat_id" FOREIGN KEY("station_id") REFERENCES EV_Charging_Stations("ID") ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
    CONSTRAINT "fk_plug_type" FOREIGN KEY("plug_type") REFERENCES EV_Charging_Station_Plug_Types("plug_type_id") DEFERRABLE INITIALLY DEFERRED
);