INSURANCE DATABASE
Q13. I) Based on the above observations, create a database named
INSURANCE with the following relations/tables:
create database insurance;
use insurance;
a.) create table person(driver_id varchar(6) primary key, dname varchar(20), address varchar(15));
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
b.) create table car(regno varchar(6) primary key, model varchar(15), yeear int);
c.) create table accident(report_no int primary key, acc_date date, location varchar(20));
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
d.) create table owns(driver_id varchar(6), regno varchar(6),primary key(driver_id,regno),
foreign key (driver_id) references person(driver_id),foreign key (regno) references car(regno));
e.) create table participated(driver_id varchar(6), regno varchar(6), report_no int, damage_amount
numeric(10,2),primary key(driver_id,regno,report_no),foreign key (driver_id) references
person(driver_id),foreign key (regno) references car(regno),foreign key (report_no) references
accident(report_no));
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
ii) Enter at least 5 tuples/records for each table/relation.
a.) insert into person values('A55','Nelson','Dharwad');
select *from person;
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
b.) insert into car values('Ka1235','Wagonar R',2002);
select *from car;
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
c.) insert into accident values(15,'2001-09-22','Banglore');
select *from accident;
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
d.) insert into owns values('A55','Ka1233');
select *from owns;
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
e.)insert into participated values('A44','ka1233',15,5000.00);
select *from participated;
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
(iii) Demonstrate how you can
a.) Update the damage amount for the car with specific regno, the accident with report number
12 to 25000.
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
b. Add a new accident to the database.
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
(iv) Find the total number of people who owned cars that
were involved in accident in2002.
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021
(v)Find the number of accidents in which cars belonging to a
specific model were involved.
NAME: AMIT GUPTA ENROLLMENT NO: 02817702021