# Monitor table then insert to another table

**URL:** <https://forums.percona.com/t/monitor-table-then-insert-to-another-table/10945>\
**Category:** MySQL & MariaDB\
**Created:** [June 19, 2021, 6:56am UTC](https://forums.percona.com/t/monitor-table-then-insert-to-another-table/10945 "2021-06-19T06:56:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![velilinux](https://avatars.discourse-cdn.com/v4/letter/v/8c91f0/32.png) [@velilinux](https://forums.percona.com/u/velilinux)\
**Post date:** [June 19, 2021, 6:56am UTC](https://forums.percona.com/t/monitor-table-then-insert-to-another-table/10945/1 "2021-06-19T06:56:31Z")

</div>

Hi, I have a table and I want to insert some columns of another table when data is added to this table. Can I do this with MySQL/MariaDB? Or should I use script?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![matthewb](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/matthewb/32/34_2.png) [@matthewb](https://forums.percona.com/u/matthewb)\
**Post date:** [June 19, 2021, 1:30pm UTC](https://forums.percona.com/t/monitor-table-then-insert-to-another-table/10945/2 "2021-06-19T13:30:39Z")

</div>

Hello @velilinux,  
You can do this with SQL standards known as triggers. Here’s an example:

```auto
CREATE TRIGGER saveRecord
AFTER INSERT ON mainTable FOR EACH ROW
BEGIN
  INSERT INTO secondTable (name, number) VALUES (NEW.name, NEW.number);
END

```
