In SQL, running on an Oracle database, write a query for each problem that solve
ID: 3586487 • Letter: I
Question
In SQL, running on an Oracle database, write a query for each problem that solves the task.
1) Find the total damage amount from all accidents in which the cars manufactured by BMW were involved -- note: the answer should include the damage produced to other cars involved in the same accidents with the BMW cars.
2) Find the average damage amount from all accidents in which the cars owned by Rubens Barrichello were not involved.
Table 1: Person Driver id Name Jenson Button Rubens Barrichello1st Ave Sebastin Vettel Mark Webber Lewis Hamilton Felipe Massa Unirersity St 8 Unirersity St Tabe 3: Owns Driver id License Report nAccident dateLocation 04-13-2008 Highland Heights Highland Heights Report nr License Driver id Damage amtExplanation / Answer
a)
Select Sum(participated.damage_amt)
From participated,Car
Where (Car.model=’BMW’) AND (Car.Lisence=Paticipated.License);
b)
Select Average(participated.damage_amt)
From participated,Person
Where (Person.Name<> ’Rubens Barrichello’) AND (Person.driver_id=Paticipated. .driver_id);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.