MYSQL没有基于字段删除的触发器吧,只有记录删除的。

解决方案 »

  1.   

    有任何DBMS支持 这种事件的触发器吗?没听说过;)
      

  2.   

    CREATE
        [DEFINER = { user | CURRENT_USER }]
        TRIGGER trigger_name trigger_time trigger_event
        ON tbl_name FOR EACH ROW trigger_stmttrigger_time —— BEFORE / AFTER ;
    trigger_event —— INSERT/UPDATE/DELETE;(从没见过alter)
      

  3.   

    那有么有基于select的的触发器?
      

  4.   

    CREATE
        [DEFINER = { user | CURRENT_USER }]
        TRIGGER trigger_name trigger_time trigger_event
        ON tbl_name FOR EACH ROW trigger_stmtThis statement creates a new trigger. It was added in MySQL 5.0.2. A trigger is a named database object that is associated with a table, and that activates when a particular event occurs for the table. The trigger becomes associated with the table named tbl_name. tbl_name must refer to a permanent table. You cannot associate a trigger with a TEMPORARY table or a view. trigger_time is the trigger action time. It can be BEFORE or AFTER to indicate that the trigger activates before or after the statement that activated it. trigger_event indicates the kind of statement that activates the trigger. The trigger_event can be one of the following: INSERT: The trigger is activated whenever a new row is inserted into the table, for example through INSERT, LOAD DATA, and REPLACE statements. UPDATE: The trigger is activated whenever a row is modified, for example through UPDATE statements. DELETE: The trigger is activated whenever a row is deleted from the table, for example through DELETE and REPLACE statements. It is important to note that the trigger_event does not so much represent the SQL statement that activates the trigger as a table operation. For example, a BEFORE trigger for INSERT would be activated by not only INSERT statements but also LOAD DATA statements. A potentially confusing example of this is the INSERT INTO .. ON DUPLICATE UPDATE ... syntax: a BEFORE INSERT trigger will activate for every row, followed by either an AFTER INSERT trigger or both the BEFORE UPDATE and AFTER UPDATE triggers, depending on whether there was a duplicate key for the row. There cannot be two triggers for a given table that have the same trigger action time and event. For example, you cannot have two BEFORE UPDATE triggers for a table. But you can have a BEFORE UPDATE and a BEFORE INSERT trigger, or a BEFORE UPDATE and an AFTER UPDATE trigger. trigger_stmt is the statement to execute when the trigger activates. If you want to execute multiple statements, use the BEGIN ... END compound statement construct. This also enables you to use the same statements that are allowable within stored routines