The following two tables used by the trigger are displayed: Create SC table CREATETABLE [SC] ([ScId] intNOTNULL, [SNo] intNOTNULL, [CNo] intNOTNULL, [Score] intDEFAULTNULL, PRIMARYKEY ([ScId]); -- add the records table CREATETABLEscore_record (SrIdintNOTNULL, SNointNOTNULL, CNointNOTNULL, OldSc
The following two tables used by the trigger are displayed: Create SC table CREATETABLE [SC] ([ScId] intNOTNULL, [SNo] intNOTNULL, [CNo] intNOTNULL, [Score] intDEFAULTNULL, PRIMARYKEY ([ScId]); -- add the records table CREATETABLEscore_record (SrIdintNOTNULL, SNointNOTNULL, CNointNOTNULL, OldSc
The following shows the two tables used by the trigger.
-- Create a SC table CREATETABLE [SC] ([ScId] intNOTNULL, [SNo] intNOTNULL, [CNo] intNOTNULL, [Score] intDEFAULTNULL, PRIMARYKEY ([ScId])
);
-- Add a resume table CREATETABLEscore_record (
SrIdintNOTNULL,
SNointNOTNULL,
CNointNOTNULL,
OldScoreintNOTNULL,
NewScoreintNOTNULL,
UpdateTimedatetimeNOTNULL, PRIMARYKEY (SrId ),
);
The following shows the Mysql write trigger.
-- Mysql write trigger -- create a trigger to insert the score before and after modification to the resume table DROPTRIGGERIFEXISTS 'triggers _ sr ';
DELIMITER // CREATETRIGGER 'trigger _ sr' AFTERUPDATEON 'scs' FOREACH rowbeginsertintoscore_recordsetsno = new. SNo,
CNo = new. CNo,
OldScore = old. Score,
NewScore = new. Score,
UpdateTime = NOW (); END // DELIMITER;
The following shows the SQL server write trigger.
-- Write trigger -- create a trigger to insert the score before and after modification to the resume table CREATETRIGGERtrigger_sronscforupdateasdeclare @
This is only the difference between triggers, such as the storage process, user-defined functions, and so on. However, we feel that we have completed learning a database language ,, the same is true for other databases.