sql 触发器未触发
Hey, folks! In this article, we will be focusing on SQL Triggers in detail.
嘿伙计! 在本文中,我们将重点关注SQL触发器 。
什么是SQL触发器? (What is a SQL Trigger?)
SQL Trigger
is a stored procedure/function that gets executed on the encounter of certain actions in the database.
SQL Trigger
是一个存储过程/函数 ,在遇到数据库中的某些操作时执行。
Triggers can be considered as a piece of code or a function that gets triggered or executed upon certain events occuring in the database values.
触发器可以被视为一段代码或一个函数,该函数或函数可以在数据库值中发生某些事件时触发或执行。
需要SQL触发器 (Need of SQL Trigger)
Let us understand the Need of a SQL Trigger with the help of an example.
让我们借助示例了解SQL触发器的需求。
Consider School/College management. Usually, whenever the teachers arrange any kind of Parent-Teachers meet, they send an email to the registered email address of the parents from the database. It is a tedious process to send invitation emails to all the candidates.
考虑学校/学院的管理。 通常,每当老师安排任何形式的家长教师见面时,他们都会从数据库中发送电子邮件到家长的注册电子邮件地址。 向所有候选人发送邀请电子邮件是一个繁琐的过程。
Now, if we replace the entire process with Triggers, that is, we write a stored procedure, it will send a mail on the entry of a new record in the database upon some specific event.
现在,如果我们将整个过程替换为Triggers,也就是说,我们编写了一个存储过程,则它将在某个特定事件发生时在数据库中新记录的条目上发送邮件。