Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can't use JOIN. 2. We have the database CAR(vin,make,model,year,color,num-doors,price) DEALERSHIP(dealer-id,name, brand, address,city,state,zip) LOT(vin, dealer-id,arrival-date) where vin is the primary key of CAR and both a

Can't use JOIN.

image text in transcribed

2. We have the database CAR(vin,make,model,year,color,num-doors,price) DEALERSHIP(dealer-id,name, brand, address,city,state,zip) LOT(vin, dealer-id,arrival-date) where vin is the primary key of CAR and both a a primary key and a foreign key in LOT (a car can only be in one lot, but it has to exist!), dealer-id is the primary key of DEALERSHIP and a foreign key in LOT, and brand is a value from make or the value 'any'; make is one of Toyota, Honda. BMW, etc. Express the following questions in SQL. Use only the operators seen in class. (a) List the name of dealerships in Louisville that sell Hondas or Toyotas. (b) List the name of dealerships in Louisville that sell Hondas and Toyotas. (c) List the name of dealerships that have more Hondas than Toyotas in their lot. (d) List the name of dealerships where the average price of their cars is less than $20,000. (e) List, for each city, the number of BMW dealerships in that city, but only if the city has at least 2 BMW dealerships (i.e. exclude cities with a single BMW dealership) (f) The stock cost of a dealership is the sum of the prices of all the cars that the dealership has on its lot. Calculate, for each dealership, its stock cost. 2. We have the database CAR(vin,make,model,year,color,num-doors,price) DEALERSHIP(dealer-id,name, brand, address,city,state,zip) LOT(vin, dealer-id,arrival-date) where vin is the primary key of CAR and both a a primary key and a foreign key in LOT (a car can only be in one lot, but it has to exist!), dealer-id is the primary key of DEALERSHIP and a foreign key in LOT, and brand is a value from make or the value 'any'; make is one of Toyota, Honda. BMW, etc. Express the following questions in SQL. Use only the operators seen in class. (a) List the name of dealerships in Louisville that sell Hondas or Toyotas. (b) List the name of dealerships in Louisville that sell Hondas and Toyotas. (c) List the name of dealerships that have more Hondas than Toyotas in their lot. (d) List the name of dealerships where the average price of their cars is less than $20,000. (e) List, for each city, the number of BMW dealerships in that city, but only if the city has at least 2 BMW dealerships (i.e. exclude cities with a single BMW dealership) (f) The stock cost of a dealership is the sum of the prices of all the cars that the dealership has on its lot. Calculate, for each dealership, its stock cost

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

XML Data Management Native XML And XML Enabled Database Systems

Authors: Akmal Chaudhri, Awais Rashid, Roberto Zicari, John Fuller

1st Edition

0201844524, 978-0201844528

Students also viewed these Databases questions