Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 719007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:35:35+00:00 2026-05-14T05:35:35+00:00

Can a trigger for a table can be applied for tracking in same table?

  • 0

Can a trigger for a table can be applied for tracking in same table?

That is IF I have table Say “employee” Now can i create a triggers such that it tracks the change in the same “employee” table

trigger such as

create trigger "<triggers_name>"  before insert on employee
For each row
Begin
 insert into employee field = timestamp;
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T05:35:36+00:00Added an answer on May 14, 2026 at 5:35 am

    In short, no.

    So let’s think about this.

    A “before” trigger will execute before the action (in this case, an “insert” action) takes place.

    If this were to work, and you attempted to do an insert into the employee table every time an insert took place on the employee table, you’d loop forever in a big recursive mess.

    Referenced from the MySQL docs

    “Within a stored function or trigger,
    it is not permitted to modify a table
    that is already being used (for
    reading or writing) by the statement
    that invoked the function or trigger.”

    See this page for more info.


    That said, if you need to do tracking when inserts take place, I would recommend using a second table which can certainly be referenced via a trigger. You and create a FK to the employee table and put your timestamp column in that new table and do something like this:

    for each row
    insert into employee_tracking (id, timestamp) on duplicate key update set timestamp = new_timestamp;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 508k
  • Answers 509k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer pyinotify is IMHO the only way to get system changes… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer I got the answer private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)… May 16, 2026 at 4:31 pm
  • Editorial Team
    Editorial Team added an answer As far as I know, there's a SendAsync method in… May 16, 2026 at 4:31 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have some procedure that perform INSERT statement: CREATE OR REPLACE PROCEDURE potok_insert( p_jfplate
I have a table named user. This table has a foreign key to a
I have a table, let's call is [MYTABLE] , with an FOR INSERT, UPDATE
I've got a table with a large number of rows that is not suitable
Inside of a trigger I'm trying to loop over all columns on a table
I have to keep track of revisions of records in a table. What I've
I'd like to create a php script that runs as a daily cron. What
I have a need to monitor a subset of fields on a table and
Is there a way you can determine the date when a trigger was updated?
I have the table Tb ID | Name | Desc ------------------------- 1 | Sample

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.