0

Hope someone can help me how to set-up an ERD diagram where you can store calculation methods or formulas.

The user should be able to add accounts:

eg

"points possible"; "ID: 1"

"points earned"; "ID: 2"

but should be also able to enter and keep a calculation out of it eg. score%

which is

"points earned"/"points possible"

or "ID:2 / ID:1"

Here's an example how this is being implemented in salesforce.com

Thanks

Community
  • 1
  • 1
YCC
  • 9
  • 2
  • this is called 'denormalization'. you should NOT do this, but instead do the calculation when you write your query. – Randy May 02 '14 at 20:20
  • Thanks Randy; but my challenge is that I don't know which types of accounts (like points earned) and how they want to do the calculations on forehand; It's kind of like salesforce.com where you can create your own formulas. – YCC May 02 '14 at 20:26

1 Answers1

0

MySQL might look like a nice formula interpreter, but do not try taking user's input as a MySQL- Command. You must interpret the user's input, otherwise very powerful things are in users hands.

So the work of parsing the user's input is on the side of the program, not the MySQL.

How you store those data needs just a few facts about what you want to store. The user gives himself points and might calculate something out of these points? Are you sure you want to implement "calc.exe" again? ;-) Without an example plan and the point where you stall nobody can help you.

flaschenpost
  • 2,205
  • 1
  • 14
  • 29