Professional Documents
Culture Documents
DBMS Insurance Database 12
DBMS Insurance Database 12
1. Create the above tables by properly specifying the primary keys and the foreign keys.
2. Enter at least five tuples for each relation .
3. Demonstrate how you
a) update the damage amount for the car with a specific Regno in the accident with report number 12 to 25000.
b) add a new accident to the database.
4. Find the total number of people who owned cars that were involved in accidents in 2002
5. Find the number of accident in which cars belonging to a specific model were involved.
6. Generation of suitable reports.
7.Create suitable front end for querying and displaying the results.
Bca expert
1. Create the above tables by properly specifying the primary keys and the foreign keys.
• Create table person(driverid varchar(10), name varchar(10), address varchar(10), primary key(driverid );
• Create table car(regno varchar(10), model varchar(10), year int, primary key (regno));
• Create table accident( reportno int, Accdate date , location varchar(10), primary key (reportno));
• Create table owns(driverid varchar(10),regno varchar(10), primary key(driverid),foreign key(driverid)
references person (driverid), foreign key(regno) reference car(regno));
• Create table participated(driverid varchar(10) ,regno varchar(10),reportno int, dmgamt int, primary key(driverid),
foreign key(driverid) references person( driverid), foreign key(regno) references car(regno),foreign key(reportno)
references accident(reportno));
Bca expert
2. Enter at least five tuples for each relation.
1. Create table person(driverid varchar(10), name varchar(10), address varchar(10), primary key(driverid );
insert into person values(‘1000’, ‘Akash’, ‘Hasan’);
insert into person values(‘1001’, ‘Ramesh’, ‘Hubli’);
insert into person values(‘1002’, ‘Preeti’, ‘Gadag’);
insert into person values(‘1003’, ‘Rahul’, ‘Bangalore’);
insert into person values(‘1004’, ‘Rohan’, ‘Mandya’);
a) update the damage amount for the car with a specific Regno in the accident with report number 12 to 25000.
update participated
set dmgamt=25000
where regno=‘MA25’ and reportno=200 ;
Rows matched :1 changed: 1 warnings: 0
select * from participated ;
+----------+---------+-----------+------------+
| driverid | regno | reportno | dmgamt |
+----------+---------+-----------+------------+
| 1000 | MA25 | 200 | 25000 |
| 1001 | KA26 | 201 | 4000 |
| 1002 | TM20 | 202 | 6000 |
| 1003 | AP25 | 203 | 8000 |
| 1004 | KA25 | 204 | 10000 |
+----------+---------+-----------+------------+ Bca expert
b) add a new accident to the database.
Bca expert
4. Find the total number of people who owned cars that were involved in accidents in 2002
select count(*)
from accident a, participated p
where a. reportno= p.reportno and Accdate BETWEEN ‘2012/01/01’ AND ‘2012/12/30’;
+-------------+
| count(*) |
+-------------+
| 3 |
+-------------+
5. Find the number of accident in which cars belonging to a specific model were involved.
select count(*)
from car c, participated p
where c.regno =p.regno and model=‘Indica’;
+-------------+
| count(*) |
+-------------+
| 1 |
+-------------+ Bca expert
E - R DIAGRAM
PARTITICIPATED ACCIDENT
Damage amount
Bca expert
INSURANCE DATA BASE
Bca expert
Thank you for watching .
- BCA EXPERT
Bca expert