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 SQL Reporting by Example Day 2: Advanced Selecting Day 2: Review


The EMPLOYEES table has 267 rows and the JOBS table has 28 rows. How many ROWS does the following query return?


Why does this not return 267 rows? I'm selecting everything from Employees. I'm joining the Jobs table, but I still have 267 rows in the Employees table.

1 Answer

Steven Parker
Steven Parker
220,634 Points

The word "JOIN" by itself is short for "INNER JOIN". So it will return rows where both tables have a JOB_ID (or ID) in common.

Since we don't have any idea what the table contents are, the output could have no rows at all (if there are no ID's in common) or any number up to the total number of employees (if they all have a JOB_ID found in the JOBS table).

Wow, ok, that makes perfect sense. I had not seen enough examples yet to realize that that is the case. And if it was explained in a module I forgot it :/

Thank you!