Subject | Re: [firebird-support] Re: Odd problem |
---|---|
Author | Ann W. Harrison |
Post date | 2005-09-22T20:01:07Z |
Brad,
associated with a table alias (aka correlation name in the standard).
Here's a response from Arno, quoting the standard. My interpretation,
like his, is that once you've established a correlation name for an
input table, the correlation name replaces the table name within the
scope of the statement.
Regards,
Ann
Again some snippets from SQL-standard:
----------------------------------------------------------------------------
----
5.4 Names and identifiers
17) An <identifier> that is a <correlation name> is associated with a
table
within a particular scope. The scope of a <correlation name> is
either a
<select statement: single row>, <subquery>, or <query specification>
(see Subclause 7.6, ''<table reference>''), or is a <trigger
definition>
(see Subclause 11.39, ''<trigger definition>''). Scopes may be
nested.
In different scopes, the same <correlation name> may be associated
with
different tables or with the same table.
General Rules
1) A <table name> identifies a table.
2) Within its scope, a <correlation name> identifies a table.
3) Within its scope, a <query name> identifies the table defined or
returned
by some associated <query expression body>.
7.6 <table reference>
4) If RV is a <correlation name> simply contained in a <table reference>,
or
a <table or query name> simply contained in a <table reference> that
does
not specify a <correlation name>, then RV is a range variable. A range
variable simply contained in a <table reference> TR is exposed by TR.
----------------------------------------------------------------------------
----
Well i think you can read it as you want :-/
I know that MSSQL doesn't allow you to use the table name if you've given a
alias, but no idea about other SQL engines?
>That's unclear.... The standard may say that when a table has been
> But its not ambiguous.
associated with a table alias (aka correlation name in the standard).
Here's a response from Arno, quoting the standard. My interpretation,
like his, is that once you've established a correlation name for an
input table, the correlation name replaces the table name within the
scope of the statement.
Regards,
Ann
>A alias is called <correlation name> in the SQL standard :
> Arno, can you refresh our memory wrt aliasses?
Again some snippets from SQL-standard:
----------------------------------------------------------------------------
----
5.4 Names and identifiers
17) An <identifier> that is a <correlation name> is associated with a
table
within a particular scope. The scope of a <correlation name> is
either a
<select statement: single row>, <subquery>, or <query specification>
(see Subclause 7.6, ''<table reference>''), or is a <trigger
definition>
(see Subclause 11.39, ''<trigger definition>''). Scopes may be
nested.
In different scopes, the same <correlation name> may be associated
with
different tables or with the same table.
General Rules
1) A <table name> identifies a table.
2) Within its scope, a <correlation name> identifies a table.
3) Within its scope, a <query name> identifies the table defined or
returned
by some associated <query expression body>.
7.6 <table reference>
4) If RV is a <correlation name> simply contained in a <table reference>,
or
a <table or query name> simply contained in a <table reference> that
does
not specify a <correlation name>, then RV is a range variable. A range
variable simply contained in a <table reference> TR is exposed by TR.
----------------------------------------------------------------------------
----
Well i think you can read it as you want :-/
I know that MSSQL doesn't allow you to use the table name if you've given a
alias, but no idea about other SQL engines?