借助 SHOW TRIGGERS 語(yǔ)句,我們可以列出特定數(shù)據(jù)庫(kù)中的所有觸發(fā)器。可以借助以下示例進(jìn)行說(shuō)明 –
示例
mysql> Show Triggers\G *************************** 1. row *************************** Trigger: trigger_before_delete_sample Event: DELETE Table: sample Statement: BEGIN SET @count = if (@count IS NULL, 1, (@count+1)); INSERT INTO sample_rowaffected values (@count); END Timing: BEFORE Created: 2017-11-21 12:31:58.70 sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERR OR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION Definer: root@localhost character_set_client: cp850 collation_connection: cp850_general_ci Database Collation: latin1_swedish_ci *************************** 2. row *************************** Trigger: before_inser_studentage Event: INSERT Table: student_age Statement: IF NEW.age < 0 THEN SET NEW.age = 0; END IF Timing: BEFORE Created: 2017-11-21 11:26:15.34 sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERR OR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION Definer: root@localhost character_set_client: cp850 collation_connection: cp850_general_ci Database Collation: latin1_swedish_ci 2 rows in set (0.01 sec)
登錄后復(fù)制
上面的結(jié)果集給出了當(dāng)前數(shù)據(jù)庫(kù)中的觸發(fā)器列表。現(xiàn)在,如果我們想獲取特定數(shù)據(jù)庫(kù)中的觸發(fā)器列表,那么我們可以使用以下語(yǔ)句 –
mysql> Show Triggers from tutorials\G Empty set (0.00 sec)
登錄后復(fù)制
上面的結(jié)果集顯示名為“tutorials”的數(shù)據(jù)庫(kù)中沒(méi)有觸發(fā)器。
以上就是我們?nèi)绾尾榭磾?shù)據(jù)庫(kù)中所有觸發(fā)器的列表?的詳細(xì)內(nèi)容,更多請(qǐng)關(guān)注www.92cms.cn其它相關(guān)文章!