0

enter image description here

This are one of the requirement that have to be done for my assignment and I am having a trouble on how or where do i start. my lecturer told us smth having a trigger and he is reluctant to guide us how we should so it.

I have an Ordertbl where if the order status are set as "Ordered" the stock will remain the same where if the status are changed to "Received" the stock increases, same as having a "Delivered" status, the qty will be deducted from the inventory:

Scenario:

I ordered product from Supplier and the status are "Ordered", then the Admin or Clerk can change the status to "Received" thus the qty will be add up to the InventoryTbl.

How do i implement the trigger thing in MySQL?

I am using .jsp. Do I have to create the trigger code in .jsp or in database?

  • You just need to make a trigger with it exact action time (BEFORE|AFTER) in the affected tables. Edit your post and add your SHOW CREATE TABLE xxxx and some data test. – oNare Oct 27 '15 at 21:18
0

You would create the trigger on each table in the mysql DB that is affected.

The article below provides information on how to create a trigger -

https://dev.mysql.com/doc/refman/5.0/en/create-trigger.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.