0% found this document useful (0 votes)
183 views12 pages

Insurance Database

The document describes creating an INSURANCE database with 5 tables: PERSON, CAR, ACCIDENT, OWNS, and PARTICIPATED. It inserts sample data into each table and demonstrates updating a damage amount, adding a new accident, finding the number of people who owned cars involved in 2002 accidents, and finding the number of accidents for a specific car model.

Uploaded by

A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
183 views12 pages

Insurance Database

The document describes creating an INSURANCE database with 5 tables: PERSON, CAR, ACCIDENT, OWNS, and PARTICIPATED. It inserts sample data into each table and demonstrates updating a damage amount, adding a new accident, finding the number of people who owned cars involved in 2002 accidents, and finding the number of accidents for a specific car model.

Uploaded by

A
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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

You might also like