Stored Procedures and triggers are a set of SQL statements. During database development, they maintain and manage databases and maintain the integrity of database references, it plays an irreplaceable role. A trigger is a special stored procedure. The stored procedure is independent of a table and has the function of accessing and manipulating database data, which further improves the application execution efficiency. A trigger is also a collection of t_ SQL statements. It works closely with tables to implement more complex business rules in tables.
Stored procedures are a collection of pre-compiled t_ SQL statements stored in a database. They can be executed independently or by calling applications.
Triggers are not directly called by users, but are automatically executed during update, insert, or delete operations on the table or view data. A table or view can have multiple triggers. Each trigger can contain complex SQL statements. in addition to the corresponding constraints of primary keys and Foreign keys, you can also use triggers to implement more complex User-Defined integrity constraints.