Jump to content

SQL Update design issue


simpli

Recommended Posts

Hi,

I have a design issue which i am struggling with. I have the following table with the following data:

used_currencies

Forex

year

Month

Rate

USD

2010

1

0.98

USD

2010

2

0.96

CAD

2010

1

1.01

 

When a user edits a form client side and saves it, he deleted, added or modified some record. The new data I have is now:

 

Forex

year

Month

Rate

USD

2010

1

0.98

USD

2010

2

0.99

USD

2010

3

1

USD

2010

4

1.01

CAD

2010

1

1.01

AUD

2010

1

1.10

 

What i am currently doing is deleting the old data and adding the new stufff. That worked until now because I had not added my referential integrity. I do not want the users to add amounts in a currency format that doesn't exist in the used_currencies table therefore i need referential integrity. Can anyone recommend a better way to do this?

 

Ideally i would have one forex row for which I would specify the rate for each month in a column but I do not know in advance the number of columns i may or may  not have so I have to do it like this. Thanks for any feedback,

JR

Link to comment
https://forums.phpfreaks.com/topic/194580-sql-update-design-issue/
Share on other sites

I would suggest that you re-read what you wrote, and see if you can better formulate a question.  Referential integrity is a good thing ... it will block improper inserts or updates.  That is not a problem with any approach, although if you were doing a single insert previously, you might want to break it up into a series of individual inserts. 

 

There's not much else I can say --- you have only sketched out a database design, with no code, and no idea what your issue is.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.