Skip site navigation (1) Skip section navigation (2)

Re: Derived tables?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: CSN <cool_screen_name90001(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Derived tables?
Date: 2004-10-28 22:39:39
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-general
CSN <cool_screen_name90001(at)yahoo(dot)com> writes:
> Just wondering - does PG support derived tables? I'm
> not really sure what the difference is between them
> and subqueries.

None whatever, at least using the definition offered by your second 

	A derived table is a select statement inside parenthesis, with
	an alias, used as a table in a join.

The SQL92 spec appears to use the phrase in exactly this way (except
they don't require the construct to appear in a join, as indeed we don't
either; the most correct explanation would probably be "used as a table
in a FROM clause").

MySQL often has their own spin on such terms ;-).  I'm not sure what
MySQL 4.1 actually supports in this line.  But I'll make a side bet that
they don't yet optimize them as well as we do ...

			regards, tom lane

In response to

pgsql-general by date

Next:From: Jim C. NasbyDate: 2004-10-28 22:47:10
Subject: Re: Reasoning behind process instead of thread based
Previous:From: Jim C. NasbyDate: 2004-10-28 22:37:29
Subject: Turning a subselect into an array

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group