9 lines
592 B
SQL
9 lines
592 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_stptms_stps CASCADE;
|
|
CREATE OR REPLACE VIEW :schema.vw_join_gncy_rts_trps_stptms_stps AS SELECT stptms.agency_id, stptms.agency_name, stptms.stop_id, stps.stop_name FROM :schema.vw_join_gncy_rts_trps_stptms AS stptms LEFT JOIN :schema.stops AS stps ON stptms.stop_id = stps.stop_id ORDER BY stptms.agency_name, stps.stop_name;
|