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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.