Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write an SQL statement that create a new table raceLap that stores the race Laps name, location, streetName, streetNumber and the length. The primary

image text in transcribed

1. Write an SQL statement that create a new table raceLap that stores the race Laps name, location, streetName, streetNumber and the length. The primary key being the combination of name and location. The length must be positive and not left blank.

2. Write an SQL statement to add an attribute difficultyLevel to the relation raceLap. Add an attribute name to the relation race and set name, location to be a foreign key in the relation race references the relation raceLap. In case of lap record is removed from the raceLap, this will reflect on the race table and remove. Note values of difficultyLevel are 1,2,3

3. Write the SQL statement that returns the racers name and associated race sponsor that drove a Mercedes car during at least one of their races.

4. Write an SQL query that returns the manufacturer whose cars won the most races

5. Write an SQL query that returns the racers name that never participated in a rallycross race

Racer A id Name 1 Sam 2 Suzan 3 Alice gender Birth_year M 1984 F 1982 F 1980 Car c id C1 C2 Manufacturer Hourse_power Mercedes 1000 Ferrari 5000 Mercedes 700 700 C3 Result result id c idrid A id Time R1_1 C1R1 1 400 R1_2 c2 R12 600 R1_ 3c3R13 375 Race R_id Type Location R1 F1 R2 RallyCross Portugal R3 F1 USA UK Sponsor R_id C_ID R1 c1 R1 C3 R2 C4 Sponsor Motorola Pepsi Michelin Schema: Racer: (A id, Name, gender, birth year) Race (r_id, type, location) Result (result id, c.id, A id, R id, time) c_id is a foreign key for car and A id is foreign key for Racer and R_id is a foreign key for Race Sponsor (R.id, C ID, Sponsor) Car (c_id, make, horsepower) Racer A id Name 1 Sam 2 Suzan 3 Alice gender Birth_year M 1984 F 1982 F 1980 Car c id C1 C2 Manufacturer Hourse_power Mercedes 1000 Ferrari 5000 Mercedes 700 700 C3 Result result id c idrid A id Time R1_1 C1R1 1 400 R1_2 c2 R12 600 R1_ 3c3R13 375 Race R_id Type Location R1 F1 R2 RallyCross Portugal R3 F1 USA UK Sponsor R_id C_ID R1 c1 R1 C3 R2 C4 Sponsor Motorola Pepsi Michelin Schema: Racer: (A id, Name, gender, birth year) Race (r_id, type, location) Result (result id, c.id, A id, R id, time) c_id is a foreign key for car and A id is foreign key for Racer and R_id is a foreign key for Race Sponsor (R.id, C ID, Sponsor) Car (c_id, make, horsepower)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional IPhone And IPad Database Application Programming

Authors: Patrick Alessi

1st Edition

0470636173, 978-0470636176

More Books

Students also viewed these Databases questions

Question

Networking is a two-way street. Discuss this statement.

Answered: 1 week ago