0
7.4kviews
write SQL queries

For the following given database, write SQL queries:

Person (driver_id:#, name, address)

Car (license, model, year)

Accident (reporcino, date, location)

Owns (driver_id:#, license)

Participated (drivercid, car, report_number, damage_amount)

(i) Find the total number of people who owned cars that were involved in accident 2004

(ii) Find the number of accidents in which the cars belonging to "HT" were involved

(iii) Update the damage an, unt for car with license number "Mum2011" in the accident with report number "AR120" to Rs. 4000

1 Answer
1
455views

i. Find the total number of people who owned cars that were involved in accident 2004?

select count (distinct name) 
from accident, participated, person 
where accident.reporcno = participated.report_number 
and participated.drivercid = person.driver_id 
and date between date ’2004-01-01’ and date ’2004-12-31’.

ii. Find the number of accidents in which the cars …

Create a free account to keep reading this post.

and 2 others joined a min ago.

Please log in to add an answer.