You are on page 1of 2

Niranjan das

(1).create table person(


driverid varchar(15)primary key,
name varchar(15),
address varchar(15));

create table car(


regno varchar(15),
model varchar(15),
year integer);

create table owns(


driverid references person,
regno varchar(10) primary key)

create table participated(


driverid references person,
regno references owns,
reportnumber integer primary key);

create table accident(


reportnumber references participated,
accddate date primary key,
location varchar(20))

2.
insert into person values ('&driverid','&name','&address');.
insert into car values('&regno','&model','&year')
insert into participated values('&driverid','&regno','&reportnumber','&damageamount');
insert into accident values('&reportnumber','&accddate','&location')

(3)a.
update participated
set damageamount=25000
where regno='ka01q2222' and reportnumber=22;

(3)b
insert into person values ('&driverid','&name','&address');.
insert into owns values('&driverid','&regno')
insert into participated values('&driverid','&regno','&reportnumber','&damageamount');
insert into accident values('&reportnumber','&accddate','&location')

(4)
select distinct count(*)"total no of pepole involved"
from accident a

1
Niranjan das

where a.accddate like '%08'

(5)
select count(*)"no of accidents"
from car c,accident a,participated p
where c.regno=p.regno and p.reportnumber=a.reportnumber and model='&model';

You might also like