Week10 - Triggers / Assess | E-BOX DBMS

Week10 - Triggers / Assess | E-BOX DBMS

Week10 - Triggers / Assess

The questions can come in any order, so make sure you are selecting right option for all questions.

1. Create a trigger named 'trigger_travel_card_af_update' that is triggered whenever the travel_card table is updated. This trigger will insert the id,person_name and action into the table 'travel_card_log_history' after the updation of travel card details. The action name in the affected log table travel_card_log_history is 'After_Update_Travel_Card'. Hints: Trigger name : trigger_travel_card_af_update Table name : travel_card_log_history Field names : id,person_name,action Action : 'After_Update_Travel_Card'.

    create or replace trigger trigger_travel_card_af_update
    after update on travel_card
    for each row
    begin
    insert into travel_card_log_history
    values(:new.id,:new.person_name,'After_Update_Travel_Card');
    end;
    /

2. Create a trigger named 'trigger_travel_payment_delete' that is triggered whenever a record in the travel_payment table is deleted. This trigger will insert the id,travel_card_id, amount and action into the table 'travel_payment_log_history' after the deletion of travel_payment details. The action name in the affected log table travel_payment_log_history is 'After_Delete_Travel_Payment'. Hints: Trigger name : trigger_travel_payment_delete Table name : travel_payment_log_history Field names : id,travel_card_id,amount,action Action : 'After_Delete_Travel_Payment'.

    create or replace trigger trigger_travel_payment_delete
    after delete on travel_payment
    for each row
    begin
    insert into travel_payment_log_history
    values(:old.id,:old.travel_card_id,:old.amount,'After_Delete_Travel_Payment');
    end;
    /