Subject Re: [firebird-support] Re: Odd problem
Author Ann W. Harrison
> But its not ambiguous.

That's unclear.... The standard may say that when a table has been
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.



> Arno, can you refresh our memory wrt aliasses?

A alias is called <correlation name> in the SQL standard :

Again some snippets from SQL-standard:
5.4 Names and identifiers

17) An <identifier> that is a <correlation name> is associated with a
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
(see Subclause 11.39, ''<trigger definition>''). Scopes may be
In different scopes, the same <correlation name> may be associated
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
by some associated <query expression body>.

7.6 <table reference>
4) If RV is a <correlation name> simply contained in a <table reference>,
a <table or query name> simply contained in a <table reference> that
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?