Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Basic MySQL. XOR?



This page from the MySQL documentation describes how to load data from a 
file into a table:

http://mysql.org/doc/refman/5.0/en/load-data.html

I don't have time to research the exact SQL to use, but it looks like 
your general strategy should be:

(1) Create two tables, t1 and t2, with a schema matching the input files.

(2) Load one file into t1 and the other file into t2.

(3) Create a third table, t3, containing all the rows that exist in t1 
and t2 (i.e., an inner join between t1 and t2)

(4) Delete all the rows from t1 and t2 that are in t3.

(5) Select the union of all rows from t1 and t2.

(This would be easier in PostgreSQL, since PostgreSQL allows UNION, 
INTERSECT and EXCEPT clauses in its SELECT statements, while MySQL, as 
far as I can tell from casually reading the documentation, only has 
UNION.  So if you have access to a PostgreSQL database for this task, 
use it.)

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.





BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org