Conner
Conner

Reputation: 675

When I insert a row, update a column in a different table

Is it possible in MySQL to create some kind of rule for a table that when I insert a new row into that table, that it updates a column in a separate table?

Thank you!

Upvotes: 0

Views: 87

Answers (2)

Aman Aggarwal
Aman Aggarwal

Reputation: 18479

You need to use AFTER INSERT Trigger for the table in which new rows being inserted.

You can check the after insert trigger here:Link

Upvotes: 0

Mukesh Kalgude
Mukesh Kalgude

Reputation: 4844

Yes it is possible. You can use trigger.You can create trigger insert on table and updated value to second table.

More details for trigger refer this link

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

Upvotes: 1

Related Questions