Update DBMS/SQL/Week7/writeup.md

This commit is contained in:
Aadit Agrawal 2025-02-18 14:55:37 +05:30
parent 1514e4d972
commit f50567be0d

View File

@ -1,67 +1,5 @@
## Week 7 - DBMS Lab - PL SQL & Triggers ## Week 7 - DBMS Lab - PL SQL & Triggers
### DB
```sql
SQL> select table_name from user_tables;
TABLE_NAME
--------------------------------------------------------------------------------
ACCIDENT
CAR
OWNS
PARTICIPATED
PERSON
SQL> select * from accident;
REPORT_NUMBER ACCD_DATE LOCATION
------------- --------- --------------------------------------------------
1 01-JAN-24 Delhi India
3 29-FEB-24 India
5 31-MAR-00 Gujrat India
12 17-JUL-00 karnataka India
SQL> select * from car;
REGNO MODEL YEAR
-------------------- ------------------------------ ----------
ABCD0001 Celtos 3
EFGH2001 Ferrari 32
DSDS0001 Urus 5
ABCD4001 Honda City 1
HFSP5601 mini cooper 7
SQL> select * from owns;
DRIVER_ID# REGNO
------------------------------ --------------------
1234 ABCD0001
1235 EFGH2001
1236 DSDS0001
1237 ABCD4001
1238 HFSP5601
SQL> select * from participated;
DRIVER_ID# REGNO REPORT_NUMBER DAMAGE_AMOUNT
------------------------------ -------------------- ------------- -------------
1234 ABCD0001 1 10000
1236 DSDS0001 3 150
1238 HFSP5601 5 1500
1238 HFSP5601 12 25000
SQL> select * from person;
DRIV NAME ADDRESS
---- ---------- ------------------------------
1234 Rohan Delhi India
1237 Saarthak Manipal India
1236 Ramesh Maharashtra India
1235 Rohit Banglalore India
1238 Amogh Muzaffarnagar
```
### Q1. Generate a trigger displaying driver information, on participating in an accident. ### Q1. Generate a trigger displaying driver information, on participating in an accident.
Trigger: Trigger: