Think about same column names in distinct tables within the same select and 
then throw in a couple of AS clauses and maybe an SQL parameter.

-----Ursprüngliche Nachricht-----
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Doug
Gesendet: Dienstag, 10. Dezember 2019 18:13
An: 'SQLite mailing list' <sqlite-users@mailinglists.sqlite.org>
Betreff: [EXTERNAL] Re: [sqlite] Result set column names

Just to be clear: If I define a column in a table named "xxx", and I "select 
xxx from table", the report will show a column named "xxx" always. That's what 
the standard says, right? It's not implementation dependent, right?

CREATE TABLE foo(xxx)
INSERT INTO foo(xxx) VALUES(25)
SELECT xxx FROM foo
---|-----
xxx 25

Doug

> -----Original Message-----
> From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org>
> On Behalf Of Adrian Ho
> Sent: Tuesday, December 10, 2019 8:04 AM
> To: sqlite-users@mailinglists.sqlite.org
> Subject: Re: [sqlite] Result set column names
>
> On 9/12/19 3:45 PM, Graham Holden wrote:
> > Monday, December 09, 2019, 7:25:25 AM, Clemens Ladisch
> <clem...@ladisch.de> wrote:
> >
> >> The SQL-92 standard actually says:
> >>
> >> |    Syntax Rules
> >> |
> >> |    9) Case:
> >> |
> >> |       b) If the i-th <derived column> in the <select list>
> does not
> >> |         specify an <as clause> and the <value expression> of
> that
> >> |         <derived column> is a single <column reference>, then
> the
> >> |         <column name> of the i-th column of the result is C.
> >> |
> > Presumably the third line of clause (b) of the standard SHOULD
> have
> > read: "is a single <column reference> C,", otherwise "is C" has
> > nothing to refer to.
>
> C is actually defined in a preceding paragraph:
>
>          5) Let C be some column. Let QS be the <query
> specification>. Let
>             DCi, for i ranging from 1 to the number of <derived
> column>s
>             inclusively, be the i-th <derived column> simply contained
> in
>             the <select list> of QS. For all i, C is an underlying
> column
>             of DCi, and of any <column reference> that identifies DCi,
> if
>             and only if C is an underlying column of the <value
> expression>
>             of DCi, or C is an underlying column of the <table
> expression>
>             immediately contained in QS.
>
> --
> Best Regards,
> Adrian
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
> users

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to