Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases Querying Relational Databases Joining Table Data with SQL JOIN Queries

Katie Martens
Katie Martens
1,587 Points

Inner Join

I haven't worked on this material in a week or two, so everything is coming back rusty. I'm trying to do the INNER JOIN, but the hint suggests something I don't have in my notes:

"You're not fully qualifying the join e.g. table1.primary_key_id = table2.foreign_key_id"

I believe my code should be attached to the post.

Steven Parker
Steven Parker
216,891 Points

Edit the question and add your code to it manually.

2 Answers

Steven Parker
Steven Parker
216,891 Points

Both VIN and StickerPrice are requested in the result set and should be part of the SELECT clause

The error message is trying to remind you that the ON clause needs to show which column of each table to use for joining, each qualified with the table name. Since the only column these tables have in common is ModelID, the ON expression should be Model.ModelID = Car.ModelID.

Katie Martens
Katie Martens
1,587 Points

SELECT ModelName FROM Model INNER JOIN Car ON VIN, StickerPrice;

That's the query I've been using, but can't figure out what the equality criteria should be after the ON keyword....