Am Do., 27. Dez. 2018 um 02:53 Uhr schrieb Mark Johnson <
mj10...@googlemail.com>:

> (summery of the last messages that were sent as email)
>
> >> Please add the list of column names after the view name:
> >> CREATE VIEW middle_earth_admin_general(a,b,c,e) AS ...
> >> I have a note to improve the documentation about this point.
>
> So would the following be true:
>
> To insure that a constant, proper column resolvement, VIEWs should be
> defined in a similar way as an INSERT command where a sub-set of columns
> with values is done:
>
> INSERT INTO gcp_master
> (name, longitude,latitude)
>  SELECT
>   name, longitude,latitude
>  FROM populated_places
>  WHERE name LIKE "roma,%";
>
>
> CREATE VIEW gcp_master_view
> (name, longitude,latitude) AS
>  SELECT
>   name, longitude,latitude
>  FROM populated_places
>  WHERE name LIKE "roma,%";
>
>
> --- Final note:
>
> When creating a VIEW with a list of defined column names, a COLUMN rename
> on the underlining TABLE:
>
> ALTER TABLE "main"."gcp_master_view" RENAME COLUMN "longitude" TO
> "position_x";
> ALTER TABLE "main"."gcp_master_view" RENAME COLUMN "latitude" TO
> "position_y";
>
Correction:

ALTER TABLE "main"."populated_places" RENAME COLUMN "longitude" TO
"position_x";
ALTER TABLE "main"."populated_places" RENAME COLUMN "latitude" TO
"position_y";

>
> will result will be:
> - rename of the COLUMN of the TABLE
> - rename of the referenced TABLE in the corresponding VIEWs and TRIGGERs
> - will NOT rename the COLUMN definition of the VIEW
>
> The final CREATE command will then look like this:
>
> CREATE VIEW gcp_master_view
> (name, longitude,latitude) AS
>  SELECT
>   name, "position_x","position_y"
>  FROM populated_places
>  WHERE name LIKE "roma,%";
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to