What is the difference between SQL Server and Mysql triggers?

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.