Re: UPDATE ... FROM vs standard SQL

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Richard Huxton <dev(at)archonet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: UPDATE ... FROM vs standard SQL
Date: 2002-06-07 18:50:55
Message-ID: 200206071150.55227.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Richard,

> Tell me about it. Where I'm using MySQL on client web-servers I find myself
> porting the data into PG to massage it then putting the results back into
> MySQL. One of the things missing from the various reviews/comparisons on the
> web is any actual comparison of usage for DBA tasks (as opposed to handling
a
> message-board app etc)

But MySQL does handle message-baord apps very well. If only MySQL AB and
NuSphere would stick to that and not try to poach in transactional database
space ...

> Nope - mostly work with PG/MySQL/MS-SQL/Access. I use all the features at
the
> psql prompt, but like to stick to the standard for app-generated queries.

Well, this will work on any database with *full* SQL92 support:

UPDATE tablea SET field3 = (SELECT field5
FROM tableb
WHERE tableb.field2 = tablea.field1);

... and won't be as slow as an IN query. Quite.

However, MS SQL 7.0 does not support correlated subqueries outside of the
WHERE clause (I'm not sure about SQL 2000). For MS Access, well, forget
using subqueries at all unless you have all day ...

And for MySQL, you're hosed. Tell your clients they need a different
database.

--
-Josh Berkus

______AGLIO DATABASE SOLUTIONS___________________________
Josh Berkus
Complete information technology josh(at)agliodbs(dot)com
and data management solutions (415) 565-7293
for law firms, small businesses fax 621-2533
and non-profit organizations. San Francisco

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Maurício Sessue Otta 2002-06-07 19:11:58 Limiting database size
Previous Message Jan Wieck 2002-06-07 18:10:24 Re: PL/pgSQL TODO