Re: compare 2 tables in sql
Hi Jonah,
Just a postscript. It is important to check
both ways. Because (sometimes) vice versa is
not necessarily true. Case in point below:
blitzen=> select * from foo
blitzen-> except
blitzen-> select * from moo;
alleleid | markerid | value | datecreated | datereplaced
----------+----------+-------+-------------+--------------
(0 rows)
blitzen=>
blitzen=> select * from moo
blitzen-> except
blitzen-> select * from foo;
some_id | anothrid | value | datecreated | datereplaced
----------+----------+-------+-------------------------+---------------------
2892473 | 2810329 | t | 2008-03-12 14:37:18.165 | 3000-01-01 12:00:00
(1 row)
Regards,
Tena Sakai
tsakai@gallo.ucsf.edu
-----Original Message-----
From: Jonah H. Harris [mailto:jonah.harris@gmail.com]
Sent: Wed 3/19/2008 3:39 PM
To: Tena Sakai
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] compare 2 tables in sql
On Wed, Mar 19, 2008 at 1:56 PM, Tena Sakai <tsakai@gallo.ucsf.edu> wrote:
> Is there a sql way to compare (in a diff/cmp sense)
> 2 tables? For example,
SELECT * FROM foo
EXCEPT
SELECT * FROM moo;
--
Jonah H. Harris, Sr. Software Architect | phone: 732.331.1324
EnterpriseDB Corporation | fax: 732.331.1301
499 Thornall Street, 2nd Floor | jonah.harris@enterprisedb.com
Edison, NJ 08837 | http://www.enterprisedb.com/