0
30kviews
Consider Insurance database given below and answer the following queries in SQL.

Person (driver_id, Name, address) - Car (license, model, year) - Accident (report_no, adate, location) - Owns (driver_id, license) - Participated (driver_id, license, report_no, damage_amount) - i. Find total number of people who owned cars that are involved in accidents in 2004. - ii. Find the number of accidents in which car belonging to ‘John Smith’ were involved. - iii. Add new accident to Database - iv. Delete ‘Santro’ belonging to ‘John Smith’ -

1 Answer
2
1.8kviews

i. Find total number of people who owned cars that are involved in accidents in 2004.

SELECT COUNT (DISTINCT name)

FROM Accident, Participated, Person

WHERE Accident.report_no= Participated.report_no

AND Participated.driver id = Person.driver id

AND date BETWEEN DATE ’2004-00-00’ and DATE ’2004-12-31’

ii. Find the number of accidents in which car …

Create a free account to keep reading this post.

and 3 others joined a min ago.

Please log in to add an answer.