chore: clean up

This commit is contained in:
dancingCycle 2024-01-03 18:39:50 +01:00
parent c4f4247421
commit 13acdd235c
5 changed files with 0 additions and 39 deletions

View File

@ -1,8 +0,0 @@
-- 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
CREATE OR REPLACE VIEW :schema.vw_route_count AS
SELECT count(DISTINCT rts.route_id) AS route_count, rts.agency_id, gncy.agency_name FROM :schema.routes AS rts LEFT JOIN :schema.agency AS gncy ON rts.agency_id = gncy.agency_id GROUP BY rts.agency_id, gncy.agency_name ORDER BY route_count DESC;

View File

@ -1,8 +0,0 @@
-- 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_route_count CASCADE;
CREATE OR REPLACE VIEW :schema.vw_route_count AS SELECT gncy_rts.agency_id, gncy_rts.agency_name, count(DISTINCT gncy_rts.route_id) AS route_count FROM :schema.vw_join_gncy_rts AS gncy_rts GROUP BY gncy_rts.agency_id, gncy_rts.agency_name ORDER BY route_count ASC;

View File

@ -1,7 +0,0 @@
-- 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
CREATE OR REPLACE VIEW :schema.vw_trip_count AS SELECT gncy.agency_name, gncy.agency_id, count(DISTINCT trps.route_id) AS route_count, count(DISTINCT trps.trip_id) AS trip_count FROM :schema.agency AS gncy LEFT JOIN :schema.routes AS rts ON rts.agency_id = gncy.agency_id LEFT JOIN :schema.trips AS trps ON trps.route_id = rts.route_id GROUP BY gncy.agency_id, gncy.agency_name ORDER BY route_count ASC, trip_count ASC;

View File

@ -1,8 +0,0 @@
-- 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_trip_count CASCADE;
CREATE OR REPLACE VIEW :schema.vw_trip_count AS SELECT gncy_rts_trps.agency_name, gncy_rts_trps.agency_id, count(DISTINCT gncy_rts_trps.route_id) AS route_count, count(DISTINCT gncy_rts_trps.trip_id) AS trip_count FROM :schema.vw_join_gncy_rts_trps AS gncy_rts_trps GROUP BY gncy_rts_trps.agency_id, gncy_rts_trps.agency_name ORDER BY route_count ASC, trip_count ASC;

View File

@ -1,8 +0,0 @@
-- 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_stps_count_gncy CASCADE;
CREATE OR REPLACE VIEW :schema.vw_stps_count_gncy AS SELECT stps.agency_id, stps.agency_name, count(DISTINCT stps.stop_id) AS stop_count FROM :schema.vw_join_gncy_rts_trps_stptms_stps AS stps GROUP BY stps.agency_id, stps.agency_name ORDER BY stop_count ASC;