diff --git a/DBMS/SQL/Week7/writeup.md b/DBMS/SQL/Week7/writeup.md index 88132aa..1b4f589 100644 --- a/DBMS/SQL/Week7/writeup.md +++ b/DBMS/SQL/Week7/writeup.md @@ -42,7 +42,7 @@ Driver_id: 1235 Name: Rohit Address: Banglalore India ``` ### Q2. Create a trigger that updates a `total_damage` column in the `accident` table whenever a new entry is added to or removed from the participated field.` - +Trigger: ```SQL SQL> CREATE OR REPLACE TRIGGER update_total_damage 2 AFTER @@ -62,9 +62,11 @@ SQL> CREATE OR REPLACE TRIGGER update_total_damage Trigger created. ``` +Adding an identifier `total_damage`: ```sql SQL> ALTER TABLE ACCIDENT ADD total_damage NUMBER; ``` +Test case with Insertion: ```sql SQL> INSERT INTO PARTICIPATED (driver_id#, regno, report_number, damage_amount) @@ -84,7 +86,9 @@ SQL> SELECT REPORT_NUMBER TOTAL_DAMAGE ------------- ------------ 1 15000 - +``` +Test case with Deletion: +```sql SQL> DELETE FROM PARTICIPATED WHERE driver_id# = '1235'