Next, to the Apex class. We use the Apex language also to create complex logic during an event. Imagine a user creates a new actor and wants to verify the actor details with an external database. You can translate this user action as the following event—after inserting an actor, make a callout to a database and add the details of the actor (such as their birthday, male/female, the color of their eyes, and so on). This means that you need to perform an action after the insertion of a record. That's what we call a trigger.
A Salesforce trigger is only executed before or after a DML operation. Yes, it can be before and after. You will learn that in The order of execution of a DML statement section. When a user inserts a new record, Salesforce will verify whether the record is compliant to all your required fields, validation rules, Apex triggers, workflow...