Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question II .8. (4 points) Write an SQL query that returns the cars that finished the race in time smaller than all races average time.
Question II .8. (4 points) Write an SQL query that returns the cars that finished the race in time smaller than all races average time.
When writing a query, write the query in a way that it would work over all possible database instances and not just for the given example instance! Consider the following database schema and example instance for a race car database: Good luck Racer A id Name 1 Sam 2 Suzan 3 Alice gender Birth year M 1984 IF 1982 IF 1980 Manufacturer Hourse power Mercedes 1000 Ferrari 5000 Mercedes 700 Race Result result id id rid Aid Time R1_1 C1R1 11 400 R1_2 c2 R12 600 R13c3R13 375 Rid Type Location R1 F1 UK R2 RallyCross Portugal R3F1 USA Sponsor Rid CID R1 C1 R13 R2 04 Sponsor Motorola Pepsi Michelin Schema: Racer: (A id, Name, gender, birth year) Race (Lid type.location) Result (result id, uid, Aid.R.id, time).id is a foreign key for car and Aid is foreign key for Racer and R.id is a foreign key for Race Sponsor (R.id. C ID. Sponsor) Car (sid, make, horsepower)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started