seany123 Posted October 28, 2011 Share Posted October 28, 2011 Basically what im wanting to do is have a value in my table be equal to whatever value1 + value2 is.. or whatever values and formula i need. can this be done without using php? So im wanting it a bit like excel... once eg value1 changes, so does the total value. can it be done? Quote Link to comment Share on other sites More sharing options...
mikosiko Posted October 28, 2011 Share Posted October 28, 2011 scroll down in this article (better if your read it completely) and look for "Third Normal Form" http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelationalDatabaseDesign.aspx what you asked can be done... yes... should be done: no (bad design)... all the calculated values should be obtained in execution time, no stored in the DB Quote Link to comment Share on other sites More sharing options...
seany123 Posted October 28, 2011 Author Share Posted October 28, 2011 scroll down in this article (better if your read it completely) and look for "Third Normal Form" http://www.deeptraining.com/litwin/dbdesign/FundamentalsOfRelationalDatabaseDesign.aspx what you asked can be done... yes... should be done: no (bad design)... all the calculated values should be obtained in execution time, no stored in the DB Okay thankyou ill be taking a look! hmm, the reason im asking for this is because im setting up a Stock exchange simulator/game and there are so many things that need updating when just a small execution is done. i was thinking that if it was already written inside mysql to update/change the values then it would be easier. Seany Quote Link to comment Share on other sites More sharing options...
fenway Posted October 28, 2011 Share Posted October 28, 2011 As long as the raw values are stored too, there's nothing wrong with a summary table to speed things up. Quote Link to comment Share on other sites More sharing options...
seany123 Posted October 28, 2011 Author Share Posted October 28, 2011 what do you mean by raw data? How would i do it inside the mysql value? if i had these values: value1: 10 value2: 50 totalvalue: value1*value2 how is that achieved inside mysql? Quote Link to comment Share on other sites More sharing options...
fenway Posted October 28, 2011 Share Posted October 28, 2011 I mean store value1, value2, and then the expression. MySQL will take most expression as column values. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.