Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In SQL, running on an Oracle database, write a query for each problem that solve

ID: 3586562 • 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.

Note: Each query should produce the results shown below respectively. Please ensure your code produces similar results.

Query 1 Result:

TOT_DAM
29000

Query 2 Result:

AVG_DAM
4500

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 amt

Explanation / Answer

Query 1:

select sum(Damage_amt) as TOT_DAM from participated where Report_nr in (select Report_nr from participated where Licence in (select Licence from car where Model='BMW'));

Query 2:

select avg(Damage_amt) from participated where Driver_id not in (select Driver_id from person where Name='RB');

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote