Question: Please write SQL queries for the following 2 questions given the db relationship below. (1)Select the make_name, vehicle_id, inventory_id, and model_name of all vehicles with
Please write SQL queries for the following 2 questions given the db relationship below.
(1)Select the make_name, vehicle_id, inventory_id, and model_name of all vehicles with the color name Bold Red and which are on the lot.
(2)Select the make_name, model_name, inventory_id and incentive amount for all vehicles on the lot with an incentive type company.
group: auto_dealer_schema
Model = { model_id:number, model_name:string, first_production_year:string 1,'Model1',"1985" 2,'Model2',"1987" 3,'2 Series',"1990" 4,'Focus',"1986" }
Make = { make_id:number, make_name:string, country:string 1,'Make1','Italy' 2,'Make2','Japan' 3,'Make3','USA' 4,'BMW','Germany' 5,'Ford','USA' }
Color = { color_id:number, name:string, code:string 1,'Sky Blue','#1869c5' 2,'Bold Red','#b00007' }
Vehicle = { vehicle_id:number, fk_make_id:number, fk_model_id:number, year:string 1,1,1,'1985' 2,4,4,'1986' 3,2,2,'1987' }
Inventory = { inventory_id:number, fk_vehicle_id:number, fk_color_id:number, price:number 1,2,1,9000 2,2,2,8000 3,2,1,9000 }
Incentive = { incentive_id:number, type:string, amount:number, conditions:string 1,'dealer',400,'only if credit score > 700' 2,'company',400,'only if credit score > 600' }
Vehicle_Incentive = { fk_vehicle_id:number, fk_incentive_id:number, valid_till:string 1,1,'2018-03-21' 2,1,'2018-03-21' }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
