Writting my own Trigger

would like to write my own trigger.

The idea is to perform some operations upon starting the trigger (such as checking an external DB for some data.

If you have any link to an example that’d be great.

Thank you in advance