9 lines
672 B
SQL
9 lines
672 B
SQL
-- colon before variable: for a prepared statement using named placeholders, this will be a parameter name of the form :name
|
|
|
|
CREATE SCHEMA IF NOT EXISTS :schema;
|
|
SET search_path to :schema, public;
|
|
|
|
---create view
|
|
DROP VIEW IF EXISTS :schema.vw_join_gncy_rts_trps CASCADE;
|
|
CREATE OR REPLACE VIEW :schema.vw_join_gncy_rts_trps AS SELECT gncy_rts.agency_id, gncy_rts.agency_name, gncy_rts.route_id, gncy_rts.route_short_name, trps.service_id, trps.trip_id, trps.trip_headsign, trps.trip_short_name FROM :schema.vw_join_gncy_rts AS gncy_rts LEFT JOIN :schema.trips AS trps ON trps.route_id = gncy_rts.route_id ORDER BY gncy_rts.agency_name, gncy_rts.route_id, trps.trip_id;
|