Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShawn Jass
7,151 PointsBummer! Your query didn't select the `MakeName`, `ModelName`, `VIN` and `StickerPrice`!
I am getting this Bummer! issue and I am stuck... would, my question according to my research this should work, or I am getting something backwards?
Challenge Task 2 of 5 In a car database there is a Make table with columns, MakeID and MakeName, a Model table with columns, ModelID,MakeID and ModelName and a Car table with columns, CarID, ModelID, VIN, ModelYear and StickerPrice. For all cars in the database, show Make Name, Model Name, VIN and Sticker Price from the Model and Car tables in one result set. Type in your command below.
Here is my code:
SELECT
MakeName
,ModelName
,VIN
,StickerPrice
FROM Make INNER JOIN Model ON Model.ModelID = Car.ModelID INNER JOIN Car ON Car.CarID = Car.CarID;
Ford Escape 1111111111111 25000.0 Chevy Escape 1111111111111 25000.0 Jeep Escape 1111111111111 25000.0 Dodge Escape 1111111111111 25000.0 Honda Escape 1111111111111 25000.0 Kia Escape 1111111111111 25000.0 Toyota Escape 1111111111111 25000.0 BMW Escape 1111111111111 25000.0 Ford Escape 222222222222 26000.0 Chevy Escape 222222222222 26000.0 Jeep Escape 222222222222 26000.0 Dodge Escape 222222222222 26000.0 Honda Escape 222222222222 26000.0 Kia Escape 222222222222 26000.0 Toyota Escape 222222222222 26000.0 BMW Escape 222222222222 26000.0 Ford Focus 333333333333333 18000.0 Chevy Focus 333333333333333 18000.0 Jeep Focus 333333333333333 18000.0 Dodge Focus 333333333333333 18000.0 Honda Focus 333333333333333 18000.0 Kia Focus 333333333333333 18000.0 Toyota Focus 333333333333333 18000.0 BMW Focus 333333333333333 18000.0 Ford Focus 444444444 18900.0 Chevy Focus 444444444 18900.0 Jeep Focus 444444444 18900.0 Dodge Focus 444444444 18900.0 Honda Focus 444444444 18900.0 Kia Focus 444444444 18900.0 Toyota Focus 444444444 18900.0 BMW Focus 444444444 18900.0 Ford Fusion 5555555555555 24600.0 Chevy Fusion 5555555555555 24600.0 Jeep Fusion 5555555555555 24600.0 Dodge Fusion 5555555555555 24600.0 Honda Fusion 5555555555555 24600.0 Kia Fusion 5555555555555 24600.0 Toyota Fusion 5555555555555 24600.0 BMW Fusion 5555555555555 24600.0 Ford Fusion 66666666666 27300.0 Chevy Fusion 66666666666 27300.0 Jeep Fusion 66666666666 27300.0 Dodge Fusion 66666666666 27300.0 Honda Fusion 66666666666 27300.0 Kia Fusion 66666666666 27300.0 Toyota Fusion 66666666666 27300.0 BMW Fusion 66666666666 27300.0 Ford Impala 777777777777 28000.0 Chevy Impala 777777777777 28000.0 Jeep Impala 777777777777 28000.0 Dodge Impala 777777777777 28000.0 Honda Impala 777777777777 28000.0 Kia Impala 777777777777 28000.0 Toyota Impala 777777777777 28000.0 BMW Impala 777777777777 28000.0 Ford Impala 88888888888888 32000.0 Chevy Impala 88888888888888 32000.0 Jeep Impala 88888888888888 32000.0 Dodge Impala 88888888888888 32000.0 Honda Impala 88888888888888 32000.0 Kia Impala 88888888888888 32000.0 Toyota Impala 88888888888888 32000.0 BMW Impala 88888888888888 32000.0 Ford Cruze 9999999999999 16500.0 Chevy Cruze 9999999999999 16500.0 Jeep Cruze 9999999999999 16500.0 Dodge Cruze 9999999999999 16500.0 Honda Cruze 9999999999999 16500.0 Kia Cruze 9999999999999 16500.0 Toyota Cruze 9999999999999 16500.0 BMW Cruze 9999999999999 16500.0 Ford Cruze 123123123123 16950.0 Chevy Cruze 123123123123 16950.0 Jeep Cruze 123123123123 16950.0 Dodge Cruze 123123123123 16950.0 Honda Cruze 123123123123 16950.0 Kia Cruze 123123123123 16950.0 Toyota Cruze 123123123123 16950.0 BMW Cruze 123123123123 16950.0 Ford Colorado 234234234234 29900.0 Chevy Colorado 234234234234 29900.0 Jeep Colorado 234234234234 29900.0 Dodge Colorado 234234234234 29900.0 Honda Colorado 234234234234 29900.0 Kia Colorado 234234234234 29900.0 Toyota Colorado 234234234234 29900.0 BMW Colorado 234234234234 29900.0 Ford Colorado 345345345345 34000.0 Chevy Colorado 345345345345 34000.0 Jeep Colorado 345345345345 34000.0 Dodge Colorado 345345345345 34000.0 Honda Colorado 345345345345 34000.0 Kia Colorado 345345345345 34000.0 Toyota Colorado 345345345345 34000.0 BMW Colorado 345345345345 34000.0 Ford Cherokee 456456456456 35500.0 Chevy Cherokee 456456456456 35500.0 Jeep Cherokee 456456456456 35500.0 Dodge Cherokee 456456456456 35500.0 Honda Cherokee 456456456456 35500.0 Kia Cherokee 456456456456 35500.0 Toyota Cherokee 456456456456 35500.0 BMW Cherokee 456456456456 35500.0 Ford Cherokee 567567567567 37900.0 Chevy Cherokee 567567567567 37900.0 Jeep Cherokee 567567567567 37900.0 Dodge Cherokee 567567567567 37900.0 Honda Cherokee 567567567567 37900.0 Kia Cherokee 567567567567 37900.0 Toyota Cherokee 567567567567 37900.0 BMW Cherokee 567567567567 37900.0 Ford Grand Cherokee 678678678678 39900.0 Chevy Grand Cherokee 678678678678 39900.0 Jeep Grand Cherokee 678678678678 39900.0 Dodge Grand Cherokee 678678678678 39900.0 Honda Grand Cherokee 678678678678 39900.0 Kia Grand Cherokee 678678678678 39900.0 Toyota Grand Cherokee 678678678678 39900.0 BMW Grand Cherokee 678678678678 39900.0 Ford Grand Cherokee 333444555666 42500.0 Chevy Grand Cherokee 333444555666 42500.0 Jeep Grand Cherokee 333444555666 42500.0 Dodge Grand Cherokee 333444555666 42500.0 Honda Grand Cherokee 333444555666 42500.0 Kia Grand Cherokee 333444555666 42500.0 Toyota Grand Cherokee 333444555666 42500.0 BMW Grand Cherokee 333444555666 42500.0 Ford Challenger 5676756464546660 27500.0 Chevy Challenger 5676756464546660 27500.0 Jeep Challenger 5676756464546660 27500.0 Dodge Challenger 5676756464546660 27500.0 Honda Challenger 5676756464546660 27500.0 Kia Challenger 5676756464546660 27500.0 Toyota Challenger 5676756464546660 27500.0 BMW Challenger 5676756464546660 27500.0 Ford Challenger 888999777555 26900.0 Chevy Challenger 888999777555 26900.0 Jeep Challenger 888999777555 26900.0 Dodge Challenger 888999777555 26900.0 Honda Challenger 888999777555 26900.0 Kia Challenger 888999777555 26900.0 Toyota Challenger 888999777555 26900.0 BMW Challenger 888999777555 26900.0 Ford Dart 987654321 18900.0 Chevy Dart 987654321 18900.0 Jeep Dart 987654321 18900.0 Dodge Dart 987654321 18900.0 Honda Dart 987654321 18900.0 Kia Dart 987654321 18900.0 Toyota Dart 987654321 18900.0 BMW Dart 987654321 18900.0 Ford Dart 7777777666666650 22000.0 Chevy Dart 7777777666666650 22000.0 Jeep Dart 7777777666666650 22000.0 Dodge Dart 7777777666666650 22000.0 Honda Dart 7777777666666650 22000.0 Kia Dart 7777777666666650 22000.0 Toyota Dart 7777777666666650 22000.0 BMW Dart 7777777666666650 22000.0 Ford Accord 99999888887777 32500.0 Chevy Accord 99999888887777 32500.0 Jeep Accord 99999888887777 32500.0 Dodge Accord 99999888887777 32500.0 Honda Accord 99999888887777 32500.0 Kia Accord 99999888887777 32500.0 Toyota Accord 99999888887777 32500.0 BMW Accord 99999888887777 32500.0 Ford Accord 66677776667777 27500.0 Chevy Accord 66677776667777 27500.0 Jeep Accord 66677776667777 27500.0 Dodge Accord 66677776667777 27500.0 Honda Accord 66677776667777 27500.0 Kia Accord 66677776667777 27500.0 Toyota Accord 66677776667777 27500.0 BMW Accord 66677776667777 27500.0 Ford CRV 22222111111145500 24500.0 Chevy CRV 22222111111145500 24500.0 Jeep CRV 22222111111145500 24500.0 Dodge CRV 22222111111145500 24500.0 Honda CRV 22222111111145500 24500.0 Kia CRV 22222111111145500 24500.0 Toyota CRV 22222111111145500 24500.0 BMW CRV 22222111111145500 24500.0 Ford CRV 45455554455555 27900.0 Chevy CRV 45455554455555 27900.0 Jeep CRV 45455554455555 27900.0 Dodge CRV 45455554455555 27900.0 Honda CRV 45455554455555 27900.0 Kia CRV 45455554455555 27900.0 Toyota CRV 45455554455555 27900.0 BMW CRV 45455554455555 27900.0 Ford Soul 6666666555533330 25000.0 Chevy Soul 6666666555533330 25000.0 Jeep Soul 6666666555533330 25000.0 Dodge Soul 6666666555533330 25000.0 Honda Soul 6666666555533330 25000.0 Kia Soul 6666666555533330 25000.0 Toyota Soul 6666666555533330 25000.0 BMW Soul 6666666555533330 25000.0 Ford Soul 7777770000000000 26500.0 Chevy Soul 7777770000000000 26500.0 Jeep Soul 7777770000000000 26500.0 Dodge Soul 7777770000000000 26500.0 Honda Soul 7777770000000000 26500.0 Kia Soul 7777770000000000 26500.0 Toyota Soul 7777770000000000 26500.0 BMW Soul 7777770000000000 26500.0 Ford Rio 90909090909 19000.0 Chevy Rio 90909090909 19000.0 Jeep Rio 90909090909 19000.0 Dodge Rio 90909090909 19000.0 Honda Rio 90909090909 19000.0 Kia Rio 90909090909 19000.0 Toyota Rio 90909090909 19000.0 BMW Rio 90909090909 19000.0 Ford Rio 3147765432 18500.0 Chevy Rio 3147765432 18500.0 Jeep Rio 3147765432 18500.0 Dodge Rio 3147765432 18500.0 Honda Rio 3147765432 18500.0 Kia Rio 3147765432 18500.0 Toyota Rio 3147765432 18500.0 BMW Rio 3147765432 18500.0 Ford Camry 6666666673333330 32000.0 Chevy Camry 6666666673333330 32000.0 Jeep Camry 6666666673333330 32000.0 Dodge Camry 6666666673333330 32000.0 Honda Camry 6666666673333330 32000.0 Kia Camry 6666666673333330 32000.0 Toyota Camry 6666666673333330 32000.0 BMW Camry 6666666673333330 32000.0 Ford Camry 2223334445552110 28000.0 Chevy Camry 2223334445552110 28000.0 Jeep Camry 2223334445552110 28000.0 Dodge Camry 2223334445552110 28000.0 Honda Camry 2223334445552110 28000.0 Kia Camry 2223334445552110 28000.0 Toyota Camry 2223334445552110 28000.0 BMW Camry 2223334445552110 28000.0 Ford Sienna 445544334455 41000.0 Chevy Sienna 445544334455 41000.0 Jeep Sienna 445544334455 41000.0 Dodge Sienna 445544334455 41000.0 Honda Sienna 445544334455 41000.0 Kia Sienna 445544334455 41000.0 Toyota Sienna 445544334455 41000.0 BMW Sienna 445544334455 41000.0 Ford Sienna 332211334455 39500.0 Chevy Sienna 332211334455 39500.0 Jeep Sienna 332211334455 39500.0 Dodge Sienna 332211334455 39500.0 Honda Sienna 332211334455 39500.0 Kia Sienna 332211334455 39500.0 Toyota Sienna 332211334455 39500.0 BMW Sienna 332211334455 39500.0 Ford Focus 778866445566 21000.0 Chevy Focus 778866445566 21000.0 Jeep Focus 778866445566 21000.0 Dodge Focus 778866445566 21000.0 Honda Focus 778866445566 21000.0 Kia Focus 778866445566 21000.0 Toyota Focus 778866445566 21000.0 BMW Focus 778866445566 21000.0 Ford Cherokee 999888777666555 36900.0 Chevy Cherokee 999888777666555 36900.0 Jeep Cherokee 999888777666555 36900.0 Dodge Cherokee 999888777666555 36900.0 Honda Cherokee 999888777666555 36900.0 Kia Cherokee 999888777666555 36900.0 Toyota Cherokee 999888777666555 36900.0 BMW Cherokee 999888777666555 36900.0 Ford Challenger 444443333322222 29000.0 Chevy Challenger 444443333322222 29000.0 Jeep Challenger 444443333322222 29000.0 Dodge Challenger 444443333322222 29000.0 Honda Challenger 444443333322222 29000.0 Kia Challenger 444443333322222 29000.0 Toyota Challenger 444443333322222 29000.0 BMW Challenger 444443333322222 29000.0 Ford Accord 5432154321 38500.0 Chevy Accord 5432154321 38500.0 Jeep Accord 5432154321 38500.0 Dodge Accord 5432154321 38500.0 Honda Accord 5432154321 38500.0 Kia Accord 5432154321 38500.0 Toyota Accord 5432154321 38500.0 BMW Accord 5432154321 38500.0
3 Answers
Larry Singleton
18,946 PointsThis is for question #1, it took me a while:
SELECT ModelName, VIN, StickerPrice FROM Car INNER JOIN Model ON Model.ModelID = Car.ModelID;
Murtaza H
8,735 PointsYou have three tables with columns as below Make - MakeID, MakeName Model - ModelID,MakeID,ModelName Car - CarID, ModelID, VIN,ModelYear,StickerPrice
colums you have to show MakeName from Make table ModelName from Model table VIN,StickerPrice from Car table
so you need to join the car table with model table on the model id and the model table with make table on the make id
your query will be such ....
Select Make.MakeName, Model.ModelName, Car.VIN,Car.StickerPrice from Car inner join Model on Car.ModelID = Model.ModelID inner join Make on Model.MakeID = Make.MakeID
Enock Addey
Courses Plus Student 10,420 PointsSELECT Make.MakeName AS "Make Name", Model.ModelName AS "Model Name", Car.VIN AS "VIN", Car.StickerPrice AS "Sticker Price" FROM Car INNER JOIN Model ON Model.ModelID = Car.ModelID INNER JOIN Make ON Make.MakeID = Model.MakeID;