Add entity, entity2 and convention load queries

Signed-off-by: Lucas Fernandes de Oliveira's avatarLucas Fernandes de Oliveira <lfoliveira@inf.ufpr.br>
parent 5221734f
-- Query which generated the table contact_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/002-load_data_convention.sql
-- and simmctic/database/create/data/contact_gesac_temp.csv
-- WARNING: Some telecenters were inserted without id_onid. Such telecenters
-- cannot be identifyed unically (without id_point) and are removed of this
-- query.
SELECT
co.cod_gesac
, ct.name AS "responsible_name"
, ct.rg AS "responsible_rg"
, ct.cpf AS "responsible_cpf"
, ct.post AS "responsible_post"
, ct.phone1 AS "responsible_phone_1"
, ct.phone2 AS "responsible_phone_2"
, ct.phone3 AS "responsible_phone_3"
FROM
point p
INNER JOIN convention co ON p.id = co.id_point
INNER JOIN contact ct ON p.id = ct.id_point
WHERE
co.cod_gesac IS NOT NULL
AND p.is_active
;
-- Query which generated the table contact_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/002-load_data_convention.sql
-- and simmctic/database/create/data/contact_gesac_temp.csv
-- WARNING: Some telecenters were inserted without id_onid. Such telecenters
-- cannot be identifyed unically (without id_point) and are removed of this
-- query.
SELECT
c.city_code
, e.access_point_id
, e.access_point_type
, ct.name AS "responsible_name"
, ct.rg AS "responsible_rg"
, ct.cpf AS "responsible_cpf"
, ct.post AS "responsible_post"
, ct.phone1 AS "responsible_phone_1"
, ct.phone2 AS "responsible_phone_2"
, ct.phone3 AS "responsible_phone_3"
FROM
point p
INNER JOIN entity e ON p.id = e.id_point
INNER JOIN city c ON p.id_city = c.id
INNER JOIN contact ct ON p.id = ct.id_point
WHERE
p.is_active
;
-- Query which generated the table contact_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/001-load_data_telecenter.sql
-- and simmctic/database/create/data/contact_telecenter_temp.csv
-- WARNING: Some telecenters were inserted without id_onid. Such telecenters
-- cannot be identifyed unically (without id_point) and are removed of this
-- query.
......
-- Query which generated the table convention_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/002-load_data_convention.sql
-- and simmctic/database/create/data/convention_temp.csv
-- WARNING: Some conventions were inserted without cod_gesac. Such convention (GESAC)
-- cannot be identifyed unically (without id_point) and are removed of this
-- query.
SELECT
c.name AS "city"
, c.state AS "state"
, a.establishment
, a.phone
, a.email
, a.street
, a.neighborhood
, a.complement
, a.reference
, a.zipcode
, a.has_alt_address
, aa.establishment AS "alternative_establishment"
, aa.phone AS "alternative_phone"
, aa.email AS "alternative_email"
, aa.street AS "alternative_street"
, aa.neighborhood AS "alternative_neighborhood"
, aa.complement AS "alternative_complement"
, aa.reference AS "alternative_reference"
, aa.zipcode AS "alternative_zipcode"
, co.id_onid
, co.cod_gesac
, co.ir
, sp.value AS "status_presence_point"
, ta.value AS "technology_admpp"
, co.lot
, co.migrated
, ct.value AS "connection_type"
, co.ip_addr
, co.ifdescr
FROM
point p
INNER JOIN city c ON c.id = p.id_city
INNER JOIN convention co ON p.id = co.id_point
LEFT OUTER JOIN address a ON p.id = a.id_point
LEFT OUTER JOIN address_alternative aa ON p.id = aa.id_point
LEFT OUTER JOIN status_presence_point sp ON co.id_status_presence_point = sp.id
LEFT OUTER JOIN connection_type ct ON co.id_connection_type = ct.id
LEFT OUTER JOIN technology_admpp ta ON co.id_technology_admpp = ta.id
WHERE
co.cod_gesac IS NOT NULL
AND p.is_active
;
-- Query which generated the table entity_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/004-load_data_entity2.sql
-- and simmctic/database/create/data/entity2_temp.csv
SELECT
c.name AS "city"
, c.state AS "state"
, a.establishment
, a.phone
, a.email
, a.street
, a.neighborhood
, a.complement
, a.reference
, a.zipcode
, a.has_alt_address
, aa.establishment AS "alternative_establishment"
, aa.phone AS "alternative_phone"
, aa.email AS "alternative_email"
, aa.street AS "alternative_street"
, aa.neighborhood AS "alternative_neighborhood"
, aa.complement AS "alternative_complement"
, aa.reference AS "alternative_reference"
, aa.zipcode AS "alternative_zipcode"
, c.city_code
, e.id_pcg
, e.ip_addr
, e.oid_output
, e.oid_input
, e.port
, e.snmp_version
, e.community
, e.password
, e.password_crypt
, e.phrase
, e.phrase_crypt
FROM
point p
INNER JOIN city c ON c.id = p.id_city
INNER JOIN entity2 e ON p.id = e.id_point
LEFT OUTER JOIN address a ON p.id = a.id_point
LEFT OUTER JOIN address_alternative aa ON p.id = aa.id_point
WHERE
p.is_active
;
-- Query which generated the table contact_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/003-load_data_entity.sql
-- and simmctic/database/create/data/entity_net_temp.csv
-- WARNING: Some telecenters were inserted without id_onid. Such telecenters
-- cannot be identifyed unically (without id_point) and are removed of this
-- query.
SELECT
c.city_code
, e.access_point_id
, e.access_point_type
, en.net
, en.gateway
, en.service_vlan
, en.service_name
FROM
point p
INNER JOIN entity e ON p.id = e.id_point
INNER JOIN city c ON p.id_city = c.id
INNER JOIN entity_net en ON p.id = en.id_point
WHERE
p.is_active
;
-- Query which generated the table entity_temp used in the
-- creation step of the simmctic database
-- for details check simmctic/database/create/data/003-load_data_entity.sql
-- and simmctic/database/create/data/entity_temp.csv
SELECT
c.name AS "city"
, c.state AS "state"
, a.establishment
, a.phone
, a.email
, a.street
, a.neighborhood
, a.complement
, a.reference
, a.zipcode
, a.has_alt_address
, aa.establishment AS "alternative_establishment"
, aa.phone AS "alternative_phone"
, aa.email AS "alternative_email"
, aa.street AS "alternative_street"
, aa.neighborhood AS "alternative_neighborhood"
, aa.complement AS "alternative_complement"
, aa.reference AS "alternative_reference"
, aa.zipcode AS "alternative_zipcode"
, c.city_code
, e.access_point_id
, e.access_point_type
, e.nobreak_ip
FROM
point p
INNER JOIN city c ON c.id = p.id_city
INNER JOIN entity e ON p.id = e.id_point
LEFT OUTER JOIN address a ON p.id = a.id_point
LEFT OUTER JOIN address_alternative aa ON p.id = aa.id_point
WHERE
p.is_active
;
......@@ -8,18 +8,8 @@
SELECT
p.is_gesac
, c.name AS "city"
c.name AS "city"
, c.state AS "state"
, t.id_onid
, t.id_proponent
, t.proponent
, t.furniture_note
, t.computer_note
, t.connection_note
, fs.value AS "furniture_situation"
, cs.value AS "computer_situation"
, cns.value AS "connection_situation"
, a.establishment
, a.phone
, a.email
......@@ -29,6 +19,23 @@ SELECT
, a.reference
, a.zipcode
, a.has_alt_address
, aa.establishment AS "alternative_establishment"
, aa.phone AS "alternative_phone"
, aa.email AS "alternative_email"
, aa.street AS "alternative_street"
, aa.neighborhood AS "alternative_neighborhood"
, aa.complement AS "alternative_complement"
, aa.reference AS "alternative_reference"
, aa.zipcode AS "alternative_zipcode"
, t.id_onid
, t.id_proponent
, t.proponent
, t.furniture_note
, t.computer_note
, t.connection_note
, fs.value AS "furniture_situation"
, cs.value AS "computer_situation"
, cns.value AS "connection_situation"
, b.name AS "beneficiary_name"
, b.corporate_name AS "corporate_name"
, b.cnpj AS "beneficiary_cnpj"
......@@ -40,6 +47,7 @@ FROM
INNER JOIN telecenter t ON p.id = t.id_point
INNER JOIN beneficiary b ON p.id = b.id_point
LEFT OUTER JOIN address a ON p.id = a.id_point
LEFT OUTER JOIN address_alternative aa ON p.id = aa.id_point
LEFT OUTER JOIN furniture_situation fs ON t.id_furniture_situation = fs.id
LEFT OUTER JOIN computer_situation cs ON t.id_computer_situation = cs.id
LEFT OUTER JOIN connection_situation cns ON t.id_connection_situation = cns.id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment