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 trial

Data Analysis

Richard gt
PLUS
Richard gt
Courses Plus Student 749 Points

join queries

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.

1 Answer

Steven Parker
Steven Parker
231,261 Points

It looks like you copied the task instructions from a challenge. Did you have a particular question about it?

In the meantime, some general hints:

  • you'll need 2 joins for 3 tables
  • each join needs to be made using a column that the tables have in common
  • the common columns may be different in the two joins
Richard gt
Richard gt
Courses Plus Student 749 Points

I am not understanding how to join 3 tables.I know two table joining please give me answer.

Steven Parker
Steven Parker
231,261 Points

You just repeat the same process for the third table. Here's a generic example:

SELECT --(list of fields)
FROM table1
INNER JOIN table2 ON table1.common = table2.common
INNER JOIN table3 ON table1.other = table3.other

The third table can be joined to the first table or the second, based on which one has the other common field.

Give it a try, and if you still have trouble show your entire query code so far.