MySQL Forums
Forum List  »  Triggers

Re: Trigger to update a value
Posted by: Peter Brawley
Date: March 19, 2018 11:27AM

Your TotalLineValue column is calculated from the values of other `material columns, so it should be either calculated when needed by queries, or made a derived column in the table, or made a column in a view based on the `material` table.

Your Trigger can just as easily say ...

... select sum(quantity*unit_price) from material ...

And btw Hungarian name notation (camel case, medial capitals) does improve readability but can wreak havoc when the db moves to a case-sensitive environment like Linux, best avoided.

Options: ReplyQuote

Written By
March 19, 2018 06:55AM
March 19, 2018 11:10AM
Re: Trigger to update a value
March 19, 2018 11:27AM
March 22, 2018 10:31AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.