Subject | Re: [firebird-support] Creating Synonym to a table |
---|---|
Author | Helen Borrie |
Post date | 2008-12-31T23:13:54Z |
At 03:05 AM 31/12/2008, you wrote:
In standard SQL there is no need to have pre-constructed synonyms to refer to the same table multiple times in a query - use relation aliasing.
For example, for a self-referencing join to retrieve a tree structure:
select
a1.pk,
a1.parent_key,
a2.parent_name
from aTable a1
join aTable a2
on a2.pk = a1.parent_key
Or a correlated re-entrant subquery:
select
a1.pk,
a1.parent_key,
(select a2.parent_name from aTable a2
where a2.pk = a1.parent_key)
from aTable a1
Otherwise, try to describe what you need your synonyms for.
./heLen
>I used to work with ORACLE. I was wondering if there is somethingNo, that's an Oracle thing.
>similar to do A synonym to a table (CREATE SYNONYM ...).
In standard SQL there is no need to have pre-constructed synonyms to refer to the same table multiple times in a query - use relation aliasing.
For example, for a self-referencing join to retrieve a tree structure:
select
a1.pk,
a1.parent_key,
a2.parent_name
from aTable a1
join aTable a2
on a2.pk = a1.parent_key
Or a correlated re-entrant subquery:
select
a1.pk,
a1.parent_key,
(select a2.parent_name from aTable a2
where a2.pk = a1.parent_key)
from aTable a1
Otherwise, try to describe what you need your synonyms for.
./heLen