dbTalk Databases Forums  

The right query?

comp.databases.theory comp.databases.theory


Discuss The right query? in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Ralf Hackmann
 
Posts: n/a

Default The right query? - 07-27-2009 , 09:05 AM






Hello,

I have the following situation.

I get an csv file from an other application daily and put it in an
mysql DB, what is not a problem.

the csv has the following fields f.e. (it has many more and other, but
that is not relevant)

F1;F2
1;T1
2;T2
3;T2

In the mySQL DB I whant to put it in a table with additional fields,
where users can add additional informations.

F1;F2;A1;A2 (A1,A2 are the Field for the additional informations)
1;T1
2;T2
3;T3

But at the next day it is possible, that the CSV-File from the other
applikation has lines deleted and line added (which and how many lines
are added and deleted I dont know before)

How must I design my Tables and create my querys, that in the table
with aditional Field the records are deleted and added, so that I dont
have to compare each record of both tables in an programming language.

Thanks

Ralf

Reply With Quote
  #2  
Old   
Bob Badour
 
Posts: n/a

Default Re: The right query? - 07-27-2009 , 09:13 AM






Ralf Hackmann wrote:

Quote:
Hello,

I have the following situation.

I get an csv file from an other application daily and put it in an
mysql DB, what is not a problem.

the csv has the following fields f.e. (it has many more and other, but
that is not relevant)

F1;F2
1;T1
2;T2
3;T2

In the mySQL DB I whant to put it in a table with additional fields,
where users can add additional informations.

F1;F2;A1;A2 (A1,A2 are the Field for the additional informations)
1;T1
2;T2
3;T3

But at the next day it is possible, that the CSV-File from the other
applikation has lines deleted and line added (which and how many lines
are added and deleted I dont know before)

How must I design my Tables and create my querys, that in the table
with aditional Field the records are deleted and added, so that I dont
have to compare each record of both tables in an programming language.

Thanks

Ralf
Use a separate staging table and use "not exists".

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.