Derived tables?

Started by CSNover 21 years ago2 messagesgeneral
Jump to latest
#1CSN
cool_screen_name90001@yahoo.com

Just wondering - does PG support derived tables? I'm
not really sure what the difference is between them
and subqueries.

http://www.mysql.com/news-and-events/press-release/release_2004_32.html
http://www.sqlservercentral.com/columnists/rmarda/derivedtablebasics_printversion.asp

__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: CSN (#1)
Re: Derived tables?

CSN <cool_screen_name90001@yahoo.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
reference:

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